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

Posted on:July 31 2010

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.





Comments:


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
Quote
2010-07-31 11:03:00


ups, thanks, corrected :)
niko
Quote
2010-07-31 11:35:00


Add comment:


Posted by:


Enter the missing letter in: "Internat?onal"


Text:

 

  

Possible Codes


Feature Code
Link [url] www.example.com [/url]
Bold [b]bold text[/b]
Quote [quote]quoted text[/quote]
Code [code]source code[/code]

Emoticons