Monday, June 7, 2010

WebGL on N900

With the recent "PR1.2" firmware upgrade of Nokia N900, a new feature was enabled in the browser - WebGL. WebGL is cool and scary. The cool part is that it is a chance to bring lots of games to to Linux users. The screenshot is from Match3D, a 3D tic-tac-toe game.

The best way to get started is with the Learning webgl tutorial. Passing through the lessons, some are clearly featuring buggy graphics. I don't know if the website, N900 browser or the OpenGL ES driver is being buggy. Which brings the scary part of WebGL - not only does one need to deal with buggy browsers, one has to deal with buggy 3D hardware/drivers! WebGL is still very much work in progress, and on N900 the webGL is rather an "easter egg" than a proper feature. For example the 3D graphics from the GPU does an extra roundtrip via CPU before appearing on the screen.

Other WebGL resources are for following blogs about WebGL, the Khronos Demo repository and more demos can be found at CubicVR site. The last CubicVR demos feature another scary new browser feature (not yet supported on N900) - audio processing in JavaScript.

5 comments:

  1. The security implications of WebGL are more scary, HTML5 in general is massively increasing the attack surface web users expose themselves to.

    ReplyDelete
  2. Hi suihkulokki,

    Many thanks for this post: learningwebgl.com is my site, and I have an N900 -- but I had no idea it had just started supporting WebGL!

    I've just taken a look at the lessons, and saw a two problems:

    * The cubes are stretching strangely in lessons 4, 5 and 5.
    * The specular highlight in lesson 15 is too large and is washed out.

    Did you see any other problems?

    I'd previously tested all of the demos in Firefox and Chromium on Windows, and readers of the blog have let me know that they work OK on Macs and in Linux, so I guess the problems are being caused either by some unexpected dependency on desktop OpenGL semantics somewhere in my code, or perhaps (as you say) bugs in the OpenGL ES driver or the browser. I'll take a closer look when I get home this evening and see if I find anything interesting.

    Cheers,

    Giles

    ReplyDelete
  3. [Trying again, with the right URL this time]

    OK, I've put together a list of WebGL demos that work on the N900. There's quite an impressive number!


    Cheers,

    Giles

    ReplyDelete
  4. Hi giles,

    Yes the cube stretching issue was what I noticed. I didn't look into why it happened. Perhaps due to lack of precision specifiers? Some other demos with rotating cubes seem to work fine.

    ReplyDelete
  5. At a guess, it's a bug in the OpenGL ES implementation. This spinning cube works, and this one has the stretching issue. But the only difference between them is that the first has some do-nothing code in the fragment shader.


    Giles

    ReplyDelete