Shader validation and other API changes

There are some API changes coming in WebGL, which will probably require pretty much all of the WebGL content out there to be modified; the changes are likely to go live in Minefield in a week or two, so we need to get moving! Vladimir Vukićević and Benoit Jacob have given the details in two posts on the public WebGL mailing list. Here’s a summary:

  • Fragment shaders will now be validated to make sure that they are correct for WebGL / OpenGL ES; previously you could get away with using quite a lot of desktop OpenGL stuff, in particular missing out the mandatory precision specifier in fragment shaders (see the mailing list for details and a fix from Vladimir). In the short term, whether or not this validation happens will be optional, decided by the brower’s user, and off by default. However, it will become mandatory, so you should switch it on now to test your content. To switch it on:
    • In Minefield, go to about:config and change webgl.shader_validator to true.
    • In Chromium, pass --enable-glsl-translator in on the command line.
    • There are no details on how to do it in WebKit yet.
  • The gl.texImage2D function has changed its signature. Brandon Jones posted about this the other week, noting that Chromium warnsyou when you use the old form; both old and new forms of the function have been supported by the browsers for a while, but the old one will soon be gone.
  • As Andor Salga mentioned recently, gl.readPixels has also changed.

So, I’m going to go through all of my demos and tutorial code and change to the new APIs; if you have WebGL content live on the Web, you should too!

You can leave a response, or trackback from your own site.

Leave a Reply

Subscribe to RSS Feed Follow Learning WebGL on Twitter