Skip navigation.
 
mlRe: Newbie Q: Is it possible to draw functional "Cocoa Controls" in an OpenGL context?
FROM : Sean McBride
DATE : Thu Feb 15 16:03:21 2007

On 2007-02-14 16:33, Matt Trinneer said:

>I've been trying to figure this out for a while but am having a 
>little trouble, being new to Cocoa, and OO programming in general. 
>Here goes:  Is it possible to draw Interface Builder controls such as 
>buttons, sliders, etc. in an OpenGL view?  I've figured out how to 
>capture bitmap representations of controls and render those in OpenGL 
>space. What I'd like to do is create 2D representations of these 
>controls in a 3D OpenGL context, while retaining the ability to 
>respond to user inputs using the interface elements built in event 
>handling, action, and output functionality .  From my reading so far 
>OpenGL seems like a suitable candidate for the 3D rendering 
>environment. However I can't figure out if there is built-in Cocoa 
>functionality to accomplish this, or, if I'd have to build it myself.


I have investigated this recently.  As others have said, overlapping
views are in general not advised.  You'll want to look at the
"UnderlaySurface" example.  It is installed with Xcode here:

/Developer/Examples/OpenGL/Cocoa/UnderlaySurface/

Note that the example, pathetically, does not even work.  The problem is
that NSPrincipleClass in UnderlaySurface-Info.plist should be "App" not
"NSApplication"- an easy fix at least.

Also the example code calls:
[[self window] setAlphaValue:.999f]

in viewDidMoveToWindow.  This seems to be completely unnecessary.

Lastly, I suggest you search the list archives (all lists) for these key
words "underlay opengl cocoa".

>Thanks for any suggestions you may be able to offer.


Your signature is _longer_ than your message, I suggest you shorten it. :)

--
____________________________________________________________
Sean McBride, B. Eng                <email_removed>
Rogue Research                        www.rogue-research.com
Mac Software Developer              Montréal, Québec, Canada

Related mailsAuthorDate
mlNewbie Q: Is it possible to draw functional "Cocoa Controls" in an OpenGL context? Matt Trinneer Feb 14, 22:33
mlRe: Newbie Q: Is it possible to draw functional "Cocoa Controls" in an OpenGL context? Daniel Steward Feb 14, 23:52
mlRe: Newbie Q: Is it possible to draw functional "Cocoa Controls" in an OpenGL context? Scott Anguish Feb 15, 00:00
mlRe: Newbie Q: Is it possible to draw functional "Cocoa Controls" in an OpenGL context? Daniel Steward Feb 15, 00:21
mlRe: Newbie Q: Is it possible to draw functional "Cocoa Controls" in an OpenGL context? Alastair Houghton Feb 15, 00:51
mlRe: Newbie Q: Is it possible to draw functional "Cocoa Controls" in an OpenGL context? Sean McBride Feb 15, 16:03