在NSOpenGLView之上绘制NSImage(使用NSBezierPath)

时间:2012-09-12 12:09:12

标签: objective-c macos opengl

我有NSImage,我为它画了NSBezierPath。之后,我需要在NSOpenGLView之上绘制NSImage,以达到如下结果:

enter image description here

是否可能,我该怎么办? NSImage准备就绪,只需要在NSOpenGLView之上绘制。

2 个答案:

答案 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