cocos2d Frequently Asked Questions¶
Yes. cocos2d uses pyglet / OpenGL so you can use 3D objects and use them within cocos2d.
You can include some 3D objects in your 2d game to improve the quality of your graphics without any problem.
Also, the default projection matrix of cocos2d is a 3D one,
so probably you won’t need to change it. But you can override
the projection matrix by registering to the
event. See the test/test_custom_on_resize.py code as an example.
To enable OpenGL depth test, you can call Director’s set_depth_test method.
Also, remember that cocos2d focuses on 2D games, so if you want to create a full-blown 3D game, Panda3d will suit you best.
Short answer: No. Long answer: Yes.
Almost everything in cocos2d is CocosNode object (
scenes, etc...), so the easiest way to use cocos2d’s sprites (or any
other CocosNode object) is to port CocosNode to your project.
Since CocosNode uses director’s get_window_size method, you shall create a Director stub in your project that implements get_window_size. You shall also call the CocosNode.visit method from your main loop to draw the sprites.
Although I haven’t tried it, I think this shall work ok. If it doesn’t work, let us know.
Yes, you can.
Since cocos2d has features like ‘scene flow control’ and transitions you can code a presentation using cocos2d relatively easy, and make it look pretty cool using those transitions.
Did you know that we have OpenGL transitions, like the ones you will find in Apple’s Keynote and OpenOffice’s Impress ? That’s cool :-)
For example, the lighting talk that we did in PyCon 2008 was coded in cocos2d. The source code is here: pycon 2008 cocos2d lighting talk
That being said, you should bear in mind that cocos2d is not a presentation tool. We are not planning to add presentation-like features to cocos2d.
If you want a python presentation tool, we recommend: Bruce the Presentation Tool
This means that your GPU doesn’t support the
cocos2d’s effects needs this extension, and some transitions that depends on some effects will need it too.
The workaround is to activate the GenericGrabber by editing the
To do so, modify these lines:
raise Exception("ERROR: GPU doesn't support Frame Buffers Objects. Can't continue") #_best_grabber = GenericGrabber #return _best_grabber()
into these ones:
#raise Exception("ERROR: GPU doesn't support Frame Buffers Objects. Can't continue") _best_grabber = GenericGrabber return _best_grabber()
WARNING : This modification will let you see the effects, but it doesn’t support some features, like having effects on layers or sprites. It will also perform much slower. And we don’t support it.
As we said, it is a workaround, not a fix.