A quick WebGL demo

by Jay Conrod
posted on 2011-08-17
updated on 2011-08-28

A few weeks ago, I moved to a new group at the same company. I now work on optimizing the V8 JavaScript JIT for mobile phones and tablets. V8 is used in Google Chrome, ChromeOS, Android, and WebOS, so it's a pretty big deal. The work has been awesome so far. Kind of a dream job.

To reduce my own incompetence, I'm learning more about JavaScript. JavaScript itself is a lot like Lua, which I used extensively in my old job, so there's not that much to learn. The interesting part is how JavaScript interacts with the web browser. That part has change a lot since I first learned it in 1999. Big surprise, right?

One thing I'm particularly interested in is WebGL. You can actually create an OpenGL ES context on a <canvas> element and animate it in JavaScript. What you see below is a very simple demo.

Canvas not supported! =[

Any modern desktop browser should support WebGL, but some may have it disabled by default. I tried this on Firefox 5, Firefox 6, and Chrome, and it worked great (a little jerky on Firefox though).

If you'd like the source for this, just hit "View Source" in your browser!