Wednesday, March 12, 2014

cocos2d-x with custom gl es 2.0 code

cocos2d-x is a great 2D engine. It is based on ES 2.0. cocos2d-x has its own 2D wrappers on top of ES 2.0 to make it across platform. As long as there is already an EGL context, it is possible to add your own opengl code, or even other 3D engine.

The straight forward way is to override the draw function of a layer class and attach it to the scene. Just put all your gl code into function draw, such as shaders, VBO, and so on. It works. I just tested with a simple triangle though. Howerver, there problem is that my layer overrides everything. The original sprites and fonts are all covered. This is not what I need. I plan to re-use those GUI on top of my own 3D layer.

There is also a post in their forum talking about embedding horde3d to cocos2d-x.

No comments:

Post a Comment