WebGL Draft Released Today

Even without a draft specification of WebGL in circulation, we’ve seen some promising 3D content using WebGL appear on the web, put together mainly through developer ingenuity and the fact that Firefox, Chromium, and WebKit are open source projects with early support for the technology. Today, the WebGL Working Group at Khronos released a provisional public draft of the WebGL specification, and we are very excited for what this means for the web.

For one thing, it means more developers can get involved in the evolution of WebGL. There’s a public mailing list set up, so that you can engage directly with members of the WebGL Working Group, as well as a web forum. It’s important to note that the specification is not yet finalized. Participation from the web community is essential towards finalizing the specification, which we hope to do in the first quarter of 2010.

It also means that there are implementations of the draft specification that you can begin to test. You can obtain a Firefox nightly that implements the WebGL draft specification, and can turn on WebGL support in that build by following these steps:

  • Type “about:config” in your browser’s URL bar
  • Do a search for “webgl” in the Filter field
  • Double-click the “enabled_for_all_sites” preference to change it to “true

Other browsers that support the draft WebGL specification are listed on the WebGL Wiki.

Now of course, this is hardware-accelerated 3D graphics in an early beta, and for now requires an OpenGL 2.0-capable GPU and drivers. In particular, most flavors of Intel’s integrated GPUs will not work straight out of the box (such as the GMA900/GMA950 often found in laptops). Developers who build nightly builds of the browser can induce software rendering using Mesa, and should check out Vlad’s blog post for doing this on Windows. Caveat emptor: building software rendering using Mesa into a Firefox nightly is likely to yield slower performance, and is only for the intrepid.

WebGL is a royalty-free, cross-platform API that brings OpenGL ES 2.0 to the web as a 3D drawing context within HTML5’s Canvas element, exposed as low-level interfaces within the Document Object Model.

Developers familiar with the Canvas 2D context will recognize that WebGL is another context for Canvas:

// get the canvas element in the DOM
var canvas = document.getElementById("canvas3D");
var gl = canvas.getContext("experimental-webgl");

Note that till the specification is finalized, the context is called experimental-webgl.

WebGL uses the OpenGL shading language, GLSL ES, and can be cleanly combined with other web content that is layered on top or underneath the 3D content. It is an emerging web standard, and is designed to be used with other parts of the web platform. The release of the draft specification is one step in bringing about a plugin free 3D API to the web, usable straight out of the box. People have already begun using it to create compelling libraries. Check out X3DOM, which is a JavaScript library using WebGL that allows users to author content in X3D. We expect developer ingenuity to surprise and awe us, as it always has.


About Arun Ranganathan

More articles by Arun Ranganathan…


  1. […] about this from Arun Ranganathan, Chair of the WebGL Working Group on hacks.mozilla.org, and of course from Vladimir Vukićević. Posted in API changes, Links | « Upcoming lesson […]

    December 10th, 2009 at 15:51
  2. […] first WebGL specification is here for your holiday leisure reading. The awesome Arun of Mozilla just posted this to the W3C […]

    December 10th, 2009 at 16:16
  3. Giles

    This is excellent news, I’m really glad to see that there’s now a better spec than the old “look at the source and guess” technique :-) Doubly glad that the spec is out in draft early enough for public feedback.

    Thanks for the link, too!

    December 10th, 2009 at 17:03
  4. […] WebGL draft specification was only published yesterday, but intrepid folks have been building demos for a while now based on early implementations. Of the […]

    December 11th, 2009 at 14:50
  5. Daniel Hendrycks

    So you do expect this to be finalized in early 2010?

    January 26th, 2010 at 06:14
  6. Delvis343

    I was just wondering about support for the Mac. I don’t think you’ll cut out a big user base by making WebGL Windows specific. Either way, you have a great product, keep up the good work!

    March 3rd, 2010 at 18:37
  7. […] which is disabled by default but can be enabled by changing a preference. See this blog post and this blog post for more […]

    April 12th, 2010 at 13:00

Comments are closed for this article.