0
votes

I am working on a mac osx control that is OpenGL based. Currently I am using an NSOpenGLView and a CVDisplayLink to coordinate my rendering on a background thread. This works great, but I need to allow Cocoa controls to be displayed over this OpenGL based control.

I realize you can do this with putting your Cocoa controls in borderless windows, however, that doesn't seem like a very good workflow for my users.

Alternatively I can make the view layer-backed and I got that working, however I don't like rendering my OpenGL content on the main thread, sometimes it blocks the main thread when the frame-rate dips.

Are there any samples that show how to achieve the best of both worlds?

1
Isn't CVDisplayLink always rendered on another thread?TheAmateurProgrammer
Yes. I am successfully rendering on a background thread with CVDisplayLink and NSOpenGLView. The problem is that I am not able to work with Cocoa controls over my NSOpenGLView.user1968080
Then what do you mean by however I don't like rendering my OpenGL content on the main thread,?TheAmateurProgrammer

1 Answers

0
votes

The background thread for rendering is completely irrelevant. You just need to enable layer-backing for the views and then the subviews/controls will be composited correctly on top of your OpenGL content. You can also use CAOpenGLLayer for more explicit layering with CALayers.