Open GoogleCodeExporter opened 9 years ago
This cryptic error message is actually the fragment shader failing to compile
properly, and can be fixed by adding the following three lines to the top of
the shader-fs script (starting around line 12 of index.html)
#ifdef GL_ES
precision highp float;
#endif
But that's not the end of the problems. The handleLoadedTexture() function has
a bad call in it:
NO: gl.texImage2D(gl.TEXTURE_2D, 0, texture.image, true);
Yes: gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE,
texture.image);
Also, all instances of "WebGLFloatArray" must be renamed "Float32Array", and
likewise "WebGLUnsignedShortArray" renamed to "Uint16Array".
The root cause of these issues is that index.html is based on an ancient
version of the Learning WebGL lesson 5, written for last year's experimental
half-baked WebGL implementations. The WebGL standard has changed a lot since
then, and in fact the Learning WebGL lessons have been updated, not only to
comply with the new standard, but the author actually replaced the matrix
library with a faster one, changed the animation from setInterval() to
requestAnimFrame(), and made numerous improvements to the clarity and
performance of the lessons.
So, someone should update the webgl-exporter and its examples to use the newest
version of Lesson 5, or preferably the newest Lesson 14, which demonstrates
loading a JSON object (which is not the same JSON structure as this script
outputs, sadly).
Original comment by elm19...@gmail.com
on 11 May 2011 at 8:39
Original issue reported on code.google.com by
fernando...@gmail.com
on 1 May 2011 at 4:23