Cocoa controls on top of NSOpenGLView

Member
Posts: 116
Joined: 2002.04
Post: #1
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.
Quote this message in a reply
Moderator
Posts: 623
Joined: 2007.09
Post: #2
I would assume you could put them in another window, and set that windows level to be above the window that contains the NSOpenGLView.

- Lincoln Green
http://www.binkworks.com/
Quote this message in a reply
DoG
Moderator
Posts: 869
Joined: 2003.01
Post: #3
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.
Quote this message in a reply
Sage
Posts: 1,232
Joined: 2002.10
Post: #4
This is what kCGLCPSurfaceOrder is for. Circa 10.2.
Quote this message in a reply
Member
Posts: 116
Joined: 2002.04
Post: #5
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?
Quote this message in a reply
Sage
Posts: 1,232
Joined: 2002.10
Post: #6
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.
Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  Nothing showing up in NSOpenGLView [newb] binaryinsomnia 6 6,510 Nov 29, 2011 07:04 PM
Last Post: binaryinsomnia
  Apple Controls in OpenGL Talyn 6 4,871 Feb 8, 2009 01:25 PM
Last Post: Talyn
  Antialiasing and NSOpenGLView attributes Jar445 2 6,565 Jan 20, 2009 10:42 AM
Last Post: maximile
  Adding NSOpenGLView class in Xcode/Interface Builder 3.0 Graphic Ace 2 3,718 Dec 5, 2007 02:15 PM
Last Post: Blacktiger
  Double-Buffering with NSOpenGLView DesertPenguin 3 5,743 Aug 1, 2006 07:17 AM
Last Post: DesertPenguin