QuickDraw(CopyBits) vs CoreGraphics(CGContextDrawImage)
I have a library I've built over the years for handling scrolling backgrounds, static backgrounds, dirty rects, etc. Basically my replacement for DrawSprocket. A long time ago I converted it to use CoreGraphics rather than QD, but the results were quite slow. Has anybody used CoreGraphics for large graphic scrolling/drawing? I have a feeling it is much better now, but I really don't want to put a lot of effort into something that will not at least match the speed of copybits. All the other animation in my game uses CoreGraphics, as small sprites seemed to achieve the same speed with both CG and copybits. I like a lot of the freebees you get with CG like alpha blending and if the speeds are up to par I thought I could do some cool effects with a lot less effort.
BTW- Before I get a bunch of "you should use OpenGL" posts, I plan on using GL in the future, but for other reasons I am trying to stick to the 2D API's (more of an education thing).
BTW- Before I get a bunch of "you should use OpenGL" posts, I plan on using GL in the future, but for other reasons I am trying to stick to the 2D API's (more of an education thing).
I've create a 2D sprite engine that uses CG and OpenGL, but CG is clearly not the best choice if you have to redraw large areas of the screen every few frames. The performance I got with CG for a 640 x 480 window was 15 fps on a fairly recent Powerbook 12".
There's a section on the ADC web-site that deals with the transition from QuickDraw to CoreGraphics, they even show how to redraw just small areas of a window, but CG is clearly not recommended for games at this point.
There's a section on the ADC web-site that deals with the transition from QuickDraw to CoreGraphics, they even show how to redraw just small areas of a window, but CG is clearly not recommended for games at this point.
*obligatory "you should use GL" post*
QuickDraw's CopyBits seems to be a lot faster than any CoreGraphics function. As far as I can tell, the only accelerated blitters on Mac OS X are CopyBits and OpenGL...
QuickDraw's CopyBits seems to be a lot faster than any CoreGraphics function. As far as I can tell, the only accelerated blitters on Mac OS X are CopyBits and OpenGL...
Thanks for the info. If I did decide to start GL for a scrolling background could someone point me to a tutorial or source that could get me started? Also, I think think this became available in 10.3, but is it cool to mix CoreGraphic sprites over GL?
Thanks,
Thanks,
cloke Wrote:Thanks for the info. If I did decide to start GL for a scrolling background could someone point me to a tutorial or source that could get me started?
I have a tutorial for using GLUT with Xcode which might help a little: http://onesadcookie.is-a-geek.net/~keith/XcodeGLUT/ . Other than that, there are lots of good threads on this board.
Quote:Also, I think think this became available in 10.3, but is it cool to mix CoreGraphic sprites over GL?
If that's even possible, which I doubt, I can't imagine it would be anything but horrifically slow.
You can print out a picture to a CG context, get the bitmap buffer of the final art and create an OpenGL texture with that, or go the other way around (print an OpenGL context out to a CG context). Although I am not sure what kind of performance you can expect, this is clearly not something to be done several times per second on a G3 or G4 Mac.
cloke Wrote:I think think this became available in 10.3, but is it cool to mix CoreGraphic sprites over GL?You can use the CGGL functions added in 10.3 to draw CoreGraphics content directly into a GL context. Currently the only documentation for this API is in CGGLContext.h.
But if your sprites are just bitmaps, it will definitely be faster to make regular GL textures out of them and stop using CG.
Possibly Related Threads...
| Thread: | Author | Replies: | Views: | Last Post | |
| VBL in CoreGraphics? | Oblivion | 16 | 6,153 |
Nov 17, 2006 02:44 PM Last Post: Ingemar |
|
| CoreGraphics sucks? OpenGL for 2d? | dave05 | 16 | 8,780 |
Jul 1, 2005 12:44 AM Last Post: Ingemar |
|
| OpenGL CopyBits Replacement... | feelgood | 19 | 7,968 |
Feb 21, 2005 01:23 AM Last Post: arekkusu |
|
| What is quickdraw? | DudetheCreator | 15 | 6,030 |
Feb 1, 2005 11:06 AM Last Post: MattDiamond |
|

