Alex headshot

AlBlue’s Blog

Macs, Modularity and More

WebGL JavaScript binding for OpenGL ES

2009, iphone

This should be interesting. OpenGL (ES), the open 3D graphics rendering toolkit currently used by all iPhones and Mac platforms, is to get a binding specifically for JavaScript, WebGL. At the moment it's only a work in progress, but it seems that this will unlock the power of the Canvas element of HTML5 to be able to drive OpenGL applications and take advantage of straight-to-hardware rendering.

Of course, JavaScript isn't necessarily the best language to be doing this in — not the lest of which is the raw computational speed (or lack thereof) but this will give Web-based developers a way of exercising OpenGL content without having to drop into an Active-X or similar native plugin. One can only hope that Apple will put their weight behind this as well, although with the QuickTime architecture already present in the Mac it may be the case that it's a slam dunk already.

It should be noted that the binding will be based on OpenGL ES 2.0, which is the graphics library behind the iPhone 3Gs. It's also worth observing that this is the cut-down specification (ES) for mobile devices, which misses out on library toolkits like GLUT, but has a much more streamlined/simplified API than the wider OpenGL specification.

It will also provide a lower barrier to entry for developers interested in playing around with OpenGL. At the moment, most* of the languages that are used with OpenGL are compiled, with the compile-test-execute cycle that can slow down investigative or experimental work. With a dynamic langauge and built-in support for OpenGL into the browser, it will be much easier to experiment with the APIs for developing 3D content. It should also be observed that this will likely transfer into skills for OpenGL games on other platforms (including the iPhone). Lastly, it may be possible to define WebGL games that will run on the iPhone natively, but delivered via the web as JavaScript and get everyone out of the black hole that is the Apple CrAppStore.

Knowing the working group, it will take a while to refine, but once it goes live, I expect that both FireFox and Safari will end up supporting the standard and that Google will sponsor an ActiveX plugin that provides the necessary for IE, on the grounds that Microsoft is likely to fight against it in their war against standards.

Lastly, this is likely to be a blow for Flash, since one of the main purposes of Flash is to provide crappy graphics on websites. Flash won't die any time soon – the development tools for Flash-based apps are probably going to carry it forward for some time to come – but WebGL might allow those applications to step up a notch for rendering games.

* Yes, there's a couple of bindings for Python and a couple for SWT/Java which is experimental through Groovy/Scala's interpreter ... but you have to go out of your way to install them over and above the web browser that you currently have installed and are reading this with