我有NSImage
,我为它画了NSBezierPath
。之后,我需要在NSOpenGLView
之上绘制NSImage,以达到如下结果:
是否可能,我该怎么办? NSImage
准备就绪,只需要在NSOpenGLView之上绘制。
答案 0 :(得分:1)
这有用吗?
NSImageView *imageView = [[NSImageView alloc] initWithFrame:your_frame_here]
[imageView setImage:image]; //Your Image
[openGLView addSubView:imageView];
答案 1 :(得分:0)
我希望这有帮助,我使用opengl也有同样的问题。我的解决方案是更改openglView
上下文的曲面顺序参数GLint order = -1; // below window
[context setValues:&order forParameter:NSOpenGLCPSurfaceOrder];
这将允许在opengl flushBuffer命令之后绘制顶视图;
这是苹果的文档表单,我发现了这个:https://developer.apple.com/library/mac/documentation/graphicsimaging/conceptual/opengl-macprogguide/opengl_contexts/opengl_contexts.html