iDevGames Forums
Cocoa controls on top of NSOpenGLView - Printable Version

+- iDevGames Forums (http://www.idevgames.com/forums)
+-- Forum: Development Zone (/forum-3.html)
+--- Forum: Graphics & Audio Programming (/forum-9.html)
+--- Thread: Cocoa controls on top of NSOpenGLView (/thread-1553.html)



Cocoa controls on top of NSOpenGLView - wadesworld - Mar 25, 2009 04:19 PM

Shouldn't it in theory be possible to place a standard Cocoa control on top of an NSOpenGLCiew? (Perhaps requiring core animation)

Interface builder certainly doesn't like it - all controls go immediately behind the NSOpenGLView.


Cocoa controls on top of NSOpenGLView - FlamingHairball - Mar 25, 2009 04:36 PM

I would assume you could put them in another window, and set that windows level to be above the window that contains the NSOpenGLView.


Cocoa controls on top of NSOpenGLView - DoG - Mar 25, 2009 05:14 PM

You can either set the OpenGL context's level to be behind the window, thus the Quartz drawing would be in front of it, or, if you want less pain, and don't require backwards compatibility with 10.4, use CoreAnimation layers. I could've sworn there was a thread about this not so long ago.


Cocoa controls on top of NSOpenGLView - arekkusu - Mar 25, 2009 10:55 PM

This is what kCGLCPSurfaceOrder is for. Circa 10.2.


Cocoa controls on top of NSOpenGLView - wadesworld - Apr 5, 2009 08:12 PM

That's perfect. However, unless I'm missing something, I don't see any way to lay out my controls on top of the OpenGL view in IB. Anything I drop on top of the NSOpenGLView goes behind it.

Am I missing something simple or is that behavior simply not supported in IB and I should create my controls at runtime after setting kCGLCPSurfaceOrder?


Cocoa controls on top of NSOpenGLView - arekkusu - Apr 6, 2009 01:38 AM

IB doesn't let you set CGL context properties, and will float NSOpenGLViews on top.

I think you can still do all of the layout in IB, if you subclass a custom view.