Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Miglu

macrumors member
Original poster
Jan 22, 2010
74
0
Which one is better for games, OpenGL or CoreAnimation?
 
Core animation is very simple to implement, so if you have a simple game, I would go that route. But it's somewhat limited, and if you're going to have relatively sophisticated gameplay, you're probably going to have to drop-down to OpenGL.

If you gave us an example of the type of game you're interested in making, you would likely get a more helpful answer.
 
I meant generally, as I want to know if I should bother learning CoreAnimation before OpenGL. But here is an example: 2D sidescroller.
 
I meant generally, as I want to know if I should bother learning CoreAnimation before OpenGL. But here is an example: 2D sidescroller.

2D graphics/animations is what CA excels at. Anything 3D is pushing it and should be done in OpenGL directly. Note though that CA provides ways to work with OpenGL directly.

CA is really for UI animations and isn't designed to create games although it certainly can. If you're not familiar with either one you'll have a learning curve to get over. 2D is pretty easy in OpenGL once you get the foundations though.

I would say go directly to OpenGL. There is much more help out there to learn OpenGL for gaming than CA.
 
I meant generally, as I want to know if I should bother learning CoreAnimation before OpenGL. But here is an example: 2D sidescroller.

Rather than using OpenGL directly it would probably be better to aim for an already existing graphics engine. There are loads available for the Mac (Ogre3D and Panda3D being the big ones).
 
To almost any possible answer to, "what kind of games?"
The correct answer is OpenGL.

Depending upon your programming and math skills, and the type of game you have in mind, I'd have to disagree with you.

It's been a while since I did a 2D side scroller (Thexder 1988, Amiga and Mac) and OpenGL would be a good choice for this type of game while CoreAnimation would not, while something more akin to Space Invader CoreAnimation would be perfectly adequate and a lot less work!

The attached Thexder 2D scrolling map demo uses OpenGL, didn't require a third party 3D engine and took about 7 hours to put together. It runs flat out no throttling of any kind and has no game play.
 

Attachments

  • Thexder.zip
    68.3 KB · Views: 73
It seems that now that I have basic Cocoa skills, I should start learning OpenGL instead of CoreAnimation in order to be able to make games. Starting from the OpenGL Programming Guide.
 
One thing I would suggest is while learning OpenGL, make sure you are up to snuff on your 3D math skillz.

If your not a great book is the 3D Math Primer which would be very handy to have while learning OpenGL.
 
As an Amazon Associate, MacRumors earns a commission from qualifying purchases made through links in this post.
One thing I would suggest is while learning OpenGL, make sure you are up to snuff on your 3D math skillz.

If your not a great book is the 3D Math Primer which would be very handy to have while learning OpenGL.

Correct me if I'm wrong but isn't the majority of graphical mathematics matrices based?
 
As an Amazon Associate, MacRumors earns a commission from qualifying purchases made through links in this post.
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.