Re: Newbie Q: Is it possible to draw functional "Cocoa Controls" in an OpenGL context?
Re: Newbie Q: Is it possible to draw functional "Cocoa Controls" in an OpenGL context?
- Subject: Re: Newbie Q: Is it possible to draw functional "Cocoa Controls" in an OpenGL context?
- From: Erik Buck <email@hidden>
- Date: Thu, 15 Feb 2007 07:57:25 -0800 (PST)
It is relatively easy to use a Cocoa view as a texture in OpenGL. Here is one example:
http://developer.apple.com/qa/qa2001/qa1325.html
It should be easy to to get WebKit to render into a texture. Even web pages with animated gifs, flash movies, and playing QuickTime could be used as dynamic textures in OpenGL. Quartz Composer and several Apple samples show how. Maybe I will hack up an example...
However, none of this is newbie work, and creating all new controls that can be dynamically used in a 3D context is going to be very hard. Imagine an NSScroller embedded in a web page. It will render fine, but how will you inter act with it ? The events to move the scroller need to go to the real view that contains the scroller and not to the OpenGL view... If you are really going to recreate new controls for use in OpenGL, you will need to heavily modify WebKit or use some other HTML rendering system.
http://developer.apple.com/cgi-bin/search.pl?q=texture+NSView&num=10&site=default_collection
http://developer.apple.com/documentation/GraphicsImaging/Conceptual/OpenGL-MacProgGuide/opengl_offscreen/chapter_5_section_3.html
If possible, I highly recommend using child windows to display normal Cocoa controls lover the OpenGL content. See this nifty example: http://developer.apple.com/samplecode/GLChildWindowDemo/listing15.html
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden