3D objects are objects that occurs on a three-axis Cartesian coordinate system. Cocos2D-x is, as you might infer from its name, a 2d gaming library. But, as it uses OpenGL internally to draw its stuff, we might leverage it to create some 3D objects on the mix. Cocos2D-x use vector 2D but with C++ we can define vector 3D.

Typedef struct {
    GLfloat x ;
    GLfloat y ;
    GLfloat z ;
} Vector3D ;

But it has some issues like :

  • Doesn’t allow you to draw sprites on top of the boxes.

  • The gluLookAt call shouldn’t be inside the Box class draw method.

  • The color shading is hardcoded.

  • And so on, so on…

Although I don’t recommend using Cocos2D-x for making a complete 3D game, adding some 3D objects might bring some interesting effects.



  • [1] http 😕/

  • [2] http 😕/ md2-models-with

  • [3] http 😕/

All Rights Reserved