14

I understand that cocos2d it's really simple API, and that I can use it to do simple and huge 2D or even sometimes 3D games/applications. As well I understand that OpenGL it's more complicated, it's lower level API etc.

Question:
What is better for implementing 2D/3D games?
Why do we need to learn OpenGL if we have simple frameworks like cocos2d?
What you can do with OpenGL that you can't do with cocos2d?

Thanks in advance!

2 Answers 2

21

What is better for implementing 2D/3D games?

  • Hard to tell, but a higher level API is always there to make things easier for you. For example you are writing a 2D shootem up. You will likely use a game loop, you will want to use sprites and make those move on the screen. You may want animations like explosions taking place. You'll end up writing your own higher level API to do those things. Cocos2D has solved those problems for you already. Any other frameworld should have solved it.

Why do we need to learn OpenGL if we have simple frameworks like cocos2d?

  • In case you like to cusomize the standard behaviour of a framework, especially the drawing part, you should get into openGL. If there is something you like to have which doesn't come out of the box you may find yourself reimplementing a base framework class. For example, look at the shaders used in Cocos2D 2.0. If you like some special blending mode, like a tinting effect, you won't get it for free. There is a colour attribute for a CCSprite but this may not be the result you're expecting. So you'll have to write your own shader and plug it into the sprite you like to be displayed in a different way.

What you can do with OpenGL that you can't do with cocos2d?

  • This comparison doesn't really work out, since cocos2d facilitates opengGL for the drawing part to build up that higher level api and make your life easier as a game developer.
0
13

Cocos2d is a wrapper around the 2D features of OpenGL (as of this: http://www.cocos2d-iphone.org/about) . Under the hood it itself uses OpenGL ES to implement its features. This is good because it means that there will be minimal performance overhead so you can start using its simpler API without having to get immersed to the definitely bigger learning path of OpenGL.

It has however only strong 2D support and if you plan to write later 3d games you loose all benefits of Cocos2d: why would you rewrite a 3d rendering engine with a 2d framework that under the hood uses a very strong 3d engine? You loose performance for a lot of unnecessary work.

So the simpler answer is: for 2d Cocos2d, for 3d OpenGL.

If you want to start OpenGL ES, this is a very good tutorial for beginners: http://iphonedevelopment.blogspot.it/2009/05/opengl-es-from-ground-up-table-of.html

2
  • @MrTJ So you wouldn't recommend having a look at Cocos3D? brenwill.com/cocos3d Mar 20, 2012 at 8:06
  • If you primary plan to develop 2D games than it will be a great idea and surely it will give you results faster. Later on when you've got some idea about game developing and want to develop also 3D games, you can look for some other framework that supports also 3D or go directly for Open GL writing your own framework.
    – MrTJ
    Mar 20, 2012 at 9:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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