Chromium Fails When Trying to Transpose in uniformMatrix May 21, 2010
Posted by Andor Saga in Open Source, Processing.js, webgl.trackback
A few weeks ago I updated Chromium, but the update broke my 3D Processing.js sketches. I didn’t have the time to look into it, so I continued using Webkit and Minefield to run my tests. This week I had a chance to check out the problem, so I loaded the C3DL splash page to see if it would render. Interestingly it worked. I then tried Processing.js, but that was still broken. How was it that Chromium rendered C3DL and not Processing.js? I knew there must be some WebGL command somewhere in Processing.js which Chromium didn’t like. I poked around our library for a while but still couldn’t get anything to render. The only thing that seemed to work was changing the background color.
I then thought about checking for any errors WebGL was reporting. I stuck a few alerts in the library:
alert(ctx.getError());
I started seeing non-zero values. WebGL was reporting error 1280. I converted this to hex (0x500) and ran a search. It turns out the error was because of an INVALID_ENUM. I kept throwing in alerts until I could isolate which command was causing this error.
I eventually found it to be this line:
ctx.uniformMatrix4fv(varLocation, transpose, matrix);
I was passing in true as the second argument and figured that must be causing the problem. I changed it to false and WebGL stopped complaining. Great! Of course nothing rendered. So to work around this problem, I just had to transpose the matrices myself before passing them to WebGL. This didn’t change Minefield or Webkit, they still run fine and now so does Chromium.
[…] it’s not all sweetness and light with Chrome. Andor Salga points out that the transpose parameter to uniformMatrix4fv doesn’t work; when you pass true, you get an […]