Symptoms
Chromium - with webgl-trace enabled
webgl-trace.js:15gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, null);
webgl-trace.js:15gl.uniformMatrix4fv(uniformLocation10, 0, new WebGLFloatArray( [0.9781476259231567, 0, 0.2079116851091385, 0, 0, 1, 0, 0, -0.2079116851091385, 0, 0.9781476259231567, 0, 120, 0, 140, 1] ));
webgl-trace.js:15gl.uniformMatrix4fv(uniformLocation11, 0, new WebGLFloatArray( [0.9781476259231567, 0, 0.2079116851091385, -146.4853515625, 0, 1, 0, 0, -0.2079116851091385, 0, 0.9781476259231567, -111.99126434326172, 0, 0, 0, 1] ));
webgl-trace.js:15gl.drawElements(gl.TRIANGLES, 36, gl.UNSIGNED_SHORT, 0);
webgl-trace.js:15WebGL error INVALID_OPERATION in drawElements(TRIANGLES, 36, UNSIGNED_SHORT, NONE)
Firefox Logs error: "glDrawElements: must have
element array buffer binding!"
Cause
The lazy buffer rebind (first line of snippet below) sometimes
binds a null buffer. When that is commented out, all is
good.
if (currentBoundGeoType != type) {
for (var i = 0; i < 8; i++) {
context.disableVertexAttribArray(i);
}
SceneJS_eventModule.fireEvent(
SceneJS_eventModule.GEOMETRY_EXPORTED,
geo);
geo.indexBuf.bind(); // Bind index buffer
currentBoundGeoType = type;
}
context.drawElements(geo.primitive, geo.indexBuf.numItems, context.UNSIGNED_SHORT, 0); // <------- Error occurs right after this line executed
context.flush();