Archive for August, 2011

Html5 Canvas vs WebGL

I started exploring the possibility to develop a game for G+ ( let’s imagine that I can start by porting a random game where you jump around on columns ).

One remaining question was to decide between WebGL and Canvas2D.
I found a blog entry on Jeff  Muizelaar site that allows anyone with a modern browser to benchmark the performance of Canvas and WebGL.
The results I got were the expected ones. They’re almost the same as what i obtained on Android between Canvas and OpenGL.

Here are the pros and cons :
WebGL :
+ Super fast and powerful rendering
+ Lots of possibilities for a 2D game, such as shading, lighting and zooming.
+ GWT API with gwt-g3d
– A bit complicated
– Low compatibility : Chrome & Firefox only
– Uncertain future due to security issues in the current specs

Canvas2D :
+ Easy to code
+ High compatibility : any HTML5 browser
+ GWT API with gwt-g2d
– Low performances : laggy with more than 50 sprites ( on non-accelerated browsers )

On my G+ post about this it has been suggested ( and on the Google Game Developer Central ) that the use of Chrome frame can solve the problem of the low compatibility of the WebGL.

In the end, the choice for WebGL was easily made.
Tales of Pocoro draws more than 200 sprites on the screen, so Canvas would never allow a descent framerate.
Those security issues and early stage specs are still a real problem, but let’s be optimistic and hope for the best.

I’ve started working with the GWT-G3D library, I’ll talk about it in my next post.