cocos2d , openGL ES or Quartz2D - Printable Version
+- iDevGames Forums (http://www.idevgames.com/forums)
+-- Forum: Development Zone (/forum-3.html)
+--- Forum: Tools & Technology (/forum-10.html)
+--- Thread: cocos2d , openGL ES or Quartz2D (/thread-9183.html)
cocos2d , openGL ES or Quartz2D - shrakrak - Jul 18, 2011 12:21 PM
plesae excuse me if this is a trivial question but i havent found any good answer so far.
i have started learning game programing with intention to write 2D games (for start) for the Iphone. i almost completed one general iphone programming book and i want to start learning how to work with an animation library
i am having problems to decide among the 3 options above. this is the impression i got from doing some reading.
openGL - is flexible powerful and cross platform but very low level and takes long to learn
Quartz2D - is simpler but less flexible and not cross platform
cocos2d - well all i know its easy to use and i can port it to android easily.
What would you suggest ?
maybe i should start with one and slowly move to another ?
Thanks in advance
RE: cocos2d , openGL ES or Quartz2D - Skorche - Jul 18, 2011 12:58 PM
OpenGL is low level, but it's not that hard to learn really. It's very flexible and can be extremely fast.
Quartz2D is too slow to use for games as it's all software rendered. IMO it is also harder to draw sprites in than OpenGL anyway. It draws nice anti-aliased vector stuff well, other than that, don't use it.
Cocos2D has decent performance, and an easy learning curve. It's fine if you just want to draw sprites, but makes it hard to draw fancy stuff as you have to understand both OpenGL and how Cocos2D uses it. Porting to Android is only possible if you use Cocos2D-x (or whatever it's called) and write your game in C++. Probably the best thing about it is that it makes it very easy to go from having an image file to a sprite moving around on the screen.
A ton of people use Cocos2D, but I don't like it personally. I prefer the flexibility of OpenGL and just write a renderer that does what I need. If you don't go feature crazy, you don't need to write a lot of OpenGL code. The renderer for Twilight Golf (http://howlingmoonsoftware.com/twilightGolf.php ) is ~500 lines of OpenGL code including the lighting/shadowing. If I took out everything except the texture loading/sprite drawing code it would be about 200.
It depends on what you want to do with your game. If you just want easy simple sprites, Cocos2D is for you. If you want fancy effects, you might find yourself fighting it instead.
RE: cocos2d , openGL ES or Quartz2D - ThemsAllTook - Jul 18, 2011 01:04 PM
Not as much as you'd think. Using the red book, it only took me two days to learn enough of the basics to make a game with it.
RE: cocos2d , openGL ES or Quartz2D - shrakrak - Jul 19, 2011 08:53 AM
thanks for the answers
im starting to get the feeling that openGL ES is worth the effort. i still have 2 doubts.
in 2D animation most of the times you are moving sprites around. this is quite simple to do in cocos2D. is it also simple in openGL? i find it hard to believe since openGL is based on drawing primitives.
And also, cocos2D handles many stuff besides graphic, stuff like touches and other user interaction. isn't that something worth using.
RE: cocos2d , openGL ES or Quartz2D - Skorche - Jul 19, 2011 09:36 AM
Sure, it's easy in OpenGL too. A sprite is just 4 vertexes and a pair of triangles from them. Here is some sprite rendering code I ripped out of one of my projects quick. I didn't take the time to comment it super well, but you should get the idea that it's not terribly hard to do.
As for Cocos2D's input handling. It's exactly like the normal iOS stuff, it basically just forwards the method calls to the Cocos2D objects. In fact, because it does this, it makes it harder to do advanced input processing because you can't easily use Apple's gesture recognizer APIs. Though games mostly don't need that sort of input.
RE: cocos2d , openGL ES or Quartz2D - shrakrak - Jul 21, 2011 04:49 AM
thanks for the answer and sharing your code
i might start with cocos2D after all just to simplify stuff for me, but im sure i will move on to openGL ES. I guess the two can also be mixed since cocos2D is based on openGL and is open source
RE: cocos2d , openGL ES or Quartz2D - timrwood - Jan 3, 2012 10:30 AM
I just finished my first iOS game and used both cocos2d and openGL.
I used cocos2D for scene management and texture loading and wrote the rest of the openGL myself.
For our next game, I'll probably ditch cocos2D altogether now that GLKit has a texture loader.