Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Core Graphics Drawing in OpenGL Context?



On 27 Jul 2007, at 13:51, Nik Youdale wrote:

Is it possible to render core graphics / cocoa drawing functions (such as bezier paths, shadows, image clipping) to an openGL context?

Not directly.

Or can one only use openGL drawing functions to draw to an openGL context?

I can think of a few options. If you have some Quartz or Cocoa stuff to draw over the top, you can create a transparent window, making it a child of the window with the OpenGL view in it (see - addChildWindow:ordered:), and draw your Quartz content into that. This is quite easy and should be pretty fast.


Alternatively, if you want to draw things you've rendered with Quartz into an OpenGL context, you can always use a bitmap graphics context (or lock focus on an NSBitmapImageRep), then draw the resulting bitmap to your OpenGL context somehow (e.g. by creating a texture and drawing a quad, or by calling glDrawPixels()). If the Quartz/Cocoa drawing isn't changing very much over time, it's probably best to make a texture (since glDrawPixels() will send the image data to the graphics card every time, instead of caching it there).

Sometimes you might also be able to get Quartz Composer to draw what you need, in which case you can just use that instead via a QCView.

I don't know if there are any other ways, but the two above should suffice for most purposes I think.

Kind regards,

Alastair.

--
http://alastairs-place.net


_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please 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:
http://lists.apple.com/mailman/options/cocoa-dev/email@hidden

This email sent to email@hidden
References: 
 >Core Graphics Drawing in OpenGL Context? (From: Nik Youdale <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.