2

I'm using R62 of Three.js but I had some rounding errors which causes my objects to be at the wrong place in my scene. I'm not talking about a few pixels, the objects are plenty of pixels away from their expected position. I found out that Matrix4 is the problem, Float32Array is not enough for my calculation. So I changed it to Float64Array and everything went fine.

I only tested in Firefox because that's the favorite browser for my target group. But now I had to test my application also in Chrome/IE/Opera to talk about the interoperability of it. I did it some months ago and all worked well, but now after my change in Matrix4 nothing happened in Chrome/Opera and the console is full of TypeErrors.

Some long hours later, I found out that in WebGLRenderer in the function setProgram the following line causes the error:

_gl.uniformMatrix4fv( p_uniforms.projectionMatrix, false, camera.projectionMatrix.elements );

Chrome/Opera give Uncaught TypeError: Type error for camera.projectionMatrix.elements but why? Google told me, that this WebGL function expects a Float32Array and not Float64array, but why is there no error in Firefox? What can I do to get it work with Float64Array? Or is there another possiblility to avoid my big rounding errors?

4

0 回答 0