Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I am planning on developing my first iPhone game, and I was wanting to know whether I should use OpenGL or CoreGraphics for a 2D game. An outline of the benefits would also be helpful.

Edit: Set this for the community wiki as the answer will be too subjective

share|improve this question

3 Answers 3

up vote 5 down vote accepted

It depends on what you're building. You may even be able to get away with just using Core Animation if it is not graphic intensive (my last two games were based off of taking advantage of Core Animation).

If you do plan to push a lot of graphics, I would highly recommend Cocos2D for your 2D game. It's based off of OpenGL ES and so far I am really enjoying it. The learning curve has been relatively smooth.

  • Integrated Box2D or Chipmunk.
  • Scene Management
  • Quite a few effects built in already (even for transitions)
  • Particle System
  • High Score Server (CocosLive) that is free for you to use
  • Text rendering support

And much more. I'd download it and play with some of the samples they have included that demos much of it's functionality.

share|improve this answer
1  
+1 for cocos2d. It is a very good option. Many games use it now: cocos2d-iphone.org/games –  Colin Gislason Jul 15 '10 at 20:01

From my experience, most 2D games on the iPhone are written in OpenGL ES. Their 2D game demo is also written in OpenGL. I would go with OpenGL, if only because you're more likely to find a lot more resources for game-related problems in OGL instead of CoreGraphics.

There are also some OS level features that make working in OpenGL less painful than on a few other platforms. For example, you can use the NSString class to render to an OpenGL context, and get full, dynamic, Unicode support right off the bat.

share|improve this answer

In a nutshell, they focus on different purposes.

CoreGraphics: Compositing and vector graphics. If you just need those, CoreGraphics is a good choice.

CoreAnimation: Animate layers of 2D objects.

OpenGL sits below those two (and CoreImage/CoreVideo, too). By virtue of being lower level, it gives you a larger degree of control. And requires you to do more work when implementing things.

So really, it depends on what you need to do. And as soon as you're considering porting that game to other platforms, OpenGL looks much more attractive, since it's supported pretty much everywhere.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.