hockeyman
hockeyman

Reputation: 1183

Draw NSImage (with NSBezierPath) on top of NSOpenGLView

I have NSImage, and I draw NSBezierPath to it. After that I need to draw that NSImage on top of NSOpenGLView to achieve result like that:

enter image description here

Is it possible, and how can I do it? NSImage is ready, it only needs to be drawn on top of NSOpenGLView.

Upvotes: 1

Views: 797

Answers (2)

Nairo
Nairo

Reputation: 23

I hope this help, I have the same problem using opengl. The solution for me was to change the surface order parameter of the context of the openglView

GLint order = -1; // below window   
[context setValues:&order forParameter:NSOpenGLCPSurfaceOrder]; 

this will allow your top view to be drawn after opengl flushBuffer command;

this is the documentation form apple where i found this: https://developer.apple.com/library/mac/documentation/graphicsimaging/conceptual/opengl-macprogguide/opengl_contexts/opengl_contexts.html

Upvotes: 0

TheAmateurProgrammer
TheAmateurProgrammer

Reputation: 9392

Does this work?

NSImageView *imageView = [[NSImageView alloc] initWithFrame:your_frame_here]
[imageView setImage:image]; //Your Image
[openGLView addSubView:imageView];

Upvotes: 1

Related Questions