CopperLicht 1.1.2 released and why all your WebGL code will break soon

WebGL is not 100% finished yet, and it is still a moving target. The next versions of browsers supporting WebGL (that is Firefox, Chrome and Safari) will introduce changes soon, breaking nearly all existing WebGL 'programs' out there. If you don't rewrite your code, your site using WebGL won't run anymore. In detail this is a subtle change to how shaders will be accepted (mandatory shader validation), and a change to the signature of a function everyone use who is loading textures, texImage2D.
Anyway, if you are using the JavaScript 3D engine CopperLicht, you are on the sunny side: You only need to download the just released latest version (version 1.1.2) and replace the copperlicht.js file you are using with the one in the SDK. That's all. Your WebGL program or game will then run both on old browsers as well on the once introducing the new changes. Which, by the way isn't that simple, because there is no real way to find out which version of texImage2D your browser is using. CopperLicht does it this way:

try
{
  // try new version
  texImage2D(target, level, internalformat, format, type, HTMLImageElement)
}
catch(e)
{
  // above will throw a DOM exception since internalformat is not a HTML element, so it must be the old version
  texImage2D(target, level, HTMLImageElement, [optional] flipY, [optional] premultiplyAlpha)
}

Not a very clean solution, but it's much better then checking the browser version, and it works everywhere. So you should update to CopperLicht 1.1.2 soon, or if you are not using it, update all your own WebGL code as soon as possible.

two comments, already:

Hey there,
it seems you forgot to update the link for copperlicht-1.1.2-sdk on the ambiera website. It still redirects me to copperlicht-1.1.1. Nice bugfixing btw :D
percX - 31 07 10 - 11:03

ups, thanks, corrected :)
niko - 31 07 10 - 11:35


Name:  
Remember personal info?
yes
no
Email (optional):
URL (optional):
Enter "layered" (antispam):
Comment:Emoticons / Textile

  ( Register your username / Log in )

Notify: Yes, send me email when someone replies.  

Small print: All html tags except <b> and <i> will be removed from your comment. You can make links by just typing the url or mail-address.
Note: If you type in your email adress above, it will be visible to other visitors, although it will be hidden for bots using javaScript.