#61 new
lindsay.kay (at xeolabs)

Lazy WebGL buffer re-bind broken

Reported by lindsay.kay (at xeolabs) | May 9th, 2010 @ 01:09 PM

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();

No comments found

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

SceneJS provides easy access to WebGL through a simple and declarative JavaScript API. The SceneJS API is functional, which enables its scene definitions to be really compact and expressive, while hooking into other JavaScript code just that little bit more smoothly.

Shared Ticket Bins

People watching this ticket

Pages