Re: NSView drawRect: QuickDraw, CoreGraphics, OpenGL ?
Re: NSView drawRect: QuickDraw, CoreGraphics, OpenGL ?
- Subject: Re: NSView drawRect: QuickDraw, CoreGraphics, OpenGL ?
- From: Brent Gulanowski <email@hidden>
- Date: Fri, 11 Oct 2002 21:26:34 -0400
On Friday, October 11, 2002, at 08:25 PM, Nat! wrote:
So the suggestions I got from my previous thread "Can I get AppKit to
draw this faster ?", confirmed my impression that AppKit is unsuitable
for performant blitting operations. Offhand I can see four ways to get
what I want
a) write my own "graphics kit" and render into a NSBitmapImageRep.
That would be painful.
b) use OpenGL. Do I still need NSOpenGLView ? Can a NSOpenGLView be
transparent now ? Can I use a mixture of OpenGL calls and AppKit calls
now in 10.2 ? F.i. can I draw a border with NSBezierPath, draw lines
with OpenGL and then put some text over it with NSAttributedString ? I
think I read somewhere that this is possible now.
Every NSView has the ability to host OpenGL and Quartz contexts, and
now, with Jaguar, they can co-exist fine in the same view at the same
time. I forget how again, I don't go for mixing them. There's no real
sample code yet I don't think... Yes you can have transparent
OpenGLViews, check ... ack, .mac is fuxored, so start at
homepage.mac.com/brentgulanowski/ and grab GLCubes to see transparent
background-sporting NSOpenGLView -- floating behind desktop icons, no
less. (I didn't write the original app, but helped figure out how to
get the tricks working.)
c) use CoreGraphics call. I am also unsure whether I can freely mix
CoreGraphics calls and AppKit calls. Is NSGraphicsContext "toll free
bridged" with CGGraphicsContext ?
I thought everybody knew you could use anything in Carbon / Core
Foundation from Cocoa! As far as I know, yeah, all CGBleah object
pointers can be transparently casted to NSBleahs pointers.
d) Quickdraw. Can I use Quickdraw calls inside drawRect: and how ?
OMG that's blasphemous! 8^) I dunno, really. Quickdraw needs a GWorld
or something. Underneath the NSView there is something, maybe it's that
CGGraphicsContext you mentioned, that you can probably draw into. But
seriously, there should be some CoreGraphics stuff you can use --
Quickdraw is implemented with it, isn't it? Come to think of it, isn't
everything on OS X using Core this or BSD that when it talks to the
kernel or hardware?
You'll find lots of Quickdraw pros on the Mac Games Dev list. Or go by
iDevGames.com.
e) what's the Apple suggested way to do performant graphics
operations in Cocoa ?
Well they told *me* to tell -you- that yes, you should do the option
from a).
Lotsa questions. Is any of that covered in the Cocoa books ? I'll buy
that one :)
It's covered in the one I'm going to write, but you have to pay me now
so I can write the book when I get around to it.
--
Brent Gulanowski email@hidden
http://inkubator.idevgames.com/
Working together to make great software.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.