WebGL: OpenGL ES 2.0 for the Web

2 minute read

As an OpenGL junkie I just have to dedicate at least one post to this topic.

By now you’ve undoubtedly heard of OpenGL ES, the OpenGL based library used on embedded devices such as cell phones and gaming consoles. OpenGL ES is what gives many Android based phones and iPhones their 3D gaming capabilities that rival the desktop machines of only a few years ago in terms of power. It seems like these days we’re all carrying a little computer in our pocket.

One of the only areas that didn’t have hardware accelerated 3D graphics up to this point was the web browser. There have been many talks about 3D browser graphics throughout the years and many more plug-ins, but nothing concrete or long lasting. This is about to change with the development of WebGL, which is a library based on OpenGL ES accessible through ECMAScript (which is basically a fancy name for JavaScript).

Yes, you’ve read that correctly: you’ll be able to use hardware accelerated graphics through JavaScript.

This opens up a myriad of possibilities for online games that were previously almost exclusive to Adobe Flash, which is a proprietary platform and requires a browser plug-in. WebGL on the other hand will be as native to your browser and as standardized as HTML, CSS, or JavaScript. And being based on OpenGL ES, you’ll have access to all the goodies that come with it such as Buffer Objects (VBOs, etc.) and GLSL shaders.

The WebGL context will be bound to the HTML 5 <canvas> element, which will serve the exact same function as a device context in OpenGL — you pretty much can’t get more generic and platform independent than that.

Currently, a widely supported WebGL implementation is still in the future but it’s coming closer by the day since we already see implementations in the beta versions of Firefox 4 and Google Chrome 5. This means that if you’re interested in WebGL and want to get an advantage, you can already pick up a copy of on of these browsers, read the draft specification, read some documentation and tutorials, and start building WebGL applications.

There are already a few (very impressive) examples out there showcasing the potential of WebGL, I’ve listed a few below and if you know any more, drop a link in a comment.