Jun 20 2012

AndEngine – GLES2 – Old and New News

Category: AndEngine,GLES2Nicolas Gramlich @ 05:23

Hello Community,

as you guys are probably already aware, since a couple of months, the current main active development branch is the so called GLES2 branch. He main difference to the old master branch, besides being actually in development and being much more awesome is that it is based on OpenGL ES 2.0. That means you can do all the fancy shit like FragmentShaders and VertexShaders, but only if you want to, since the public API is almost identical to the old OpenGL ES 1.0/1.1 based master branch.

To give you an impression of what you can do, have a look at the DreamZoo, first game based on the GLES2 branch that we here in Zynga released in early 2012:

Did you check how smooth the animals animate and how they can have a infinite variety of colors/patterns? It’s impossible to do using sprites animations, instead we did: this, which is impossible without VertexShaders and FramentShaders.

Switching a project from GLES1 to GLES2 is usually not too difficult, if you didn’t scratch the surface of AndEngine too deep (i.e. added custom object/rendering). If you decide so, you’ll be able to fix 90% of the compile errors, by organizing the imports. 8% of the remaining 10% will be common sense and for the final 2% will get resolved in the forums.

 

In fact if you really want to be on the cutting edge of AndEngine, where the cool kids are, you go for a spin-off of the GLES2 branch, the GLES2-AnchorCenter branch. The main difference of this branch is that the coordinate system has changed.

Important note: Rather sooner than later the GLES2-AnchorCenter branch will be merged into the GLES2 branch!

The coordinate system in the GLES2-AnchorCenter branch has its origin in the lower left. This was changed for multiple reasons:

  • It is the native OpenGL coordinate system. (I can save a few +- calculations here and there.)
  • It is the same coordinate system as cocos2d-iphone and cocos2d-x. (This eases porting efforts in both directions by a whole bunch!)
  • It allowed me to easily/efficiently write the AndEngineCocosBuilderExtension, which allows reading a format exported by¬†CocosBuilder.
  • It just feels more natural for any side-scrolling game.

Another thing that changed in this branch is that the anchorpoints (rotatincenter, scalecenter, etc…) are now relative, from 0.0 to 1.0, instead of being absolute values. So in general, AndEngine got a little more cocos2d-like on this branch, which is definitely not a bad thing.

Best Regards,
Nicolas

Leave a Reply