aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2012-04-24 18:09:03 -0700
committerAlon Zakai <alonzakai@gmail.com>2012-04-24 18:15:58 -0700
commitd526babf9654a0f401fa22eb04bcd27d76fc131a (patch)
tree3870e4a2b792b9fd179cb078b6d24d0c89c91da7
parent0f5ed11b876c252edf5bf9e2716ff6096d4238d0 (diff)
clean up gl emulation flush, remove unneeded and incorrect bindings
-rw-r--r--src/library_gl.js18
-rwxr-xr-xtests/runner.py2
2 files changed, 15 insertions, 5 deletions
diff --git a/src/library_gl.js b/src/library_gl.js
index ea0301ac..9bf206f5 100644
--- a/src/library_gl.js
+++ b/src/library_gl.js
@@ -1430,12 +1430,15 @@ var LibraryGL = {
Module.ctx.bufferData(Module.ctx.ELEMENT_ARRAY_BUFFER, this.indexData.subarray(0, numIndexes), Module.ctx.STATIC_DRAW);
}
- Module.ctx.bindBuffer(Module.ctx.ARRAY_BUFFER, this.vertexObject);
- Module.ctx.bufferData(Module.ctx.ARRAY_BUFFER, this.vertexData.subarray(0, this.vertexCounter), Module.ctx.STATIC_DRAW);
+ if (!GL.currArrayBuffer) {
+ Module.ctx.bindBuffer(Module.ctx.ARRAY_BUFFER, this.vertexObject);
+ Module.ctx.bufferData(Module.ctx.ARRAY_BUFFER, this.vertexData.subarray(0, this.vertexCounter), Module.ctx.STATIC_DRAW);
+ }
// Render
- Module.ctx.useProgram(renderer.program);
- Module.ctx.bindBuffer(Module.ctx.ARRAY_BUFFER, this.vertexObject);
+ if (!GL.currProgram) {
+ Module.ctx.useProgram(renderer.program);
+ }
renderer.prepare();
@@ -1448,6 +1451,13 @@ var LibraryGL = {
Module.ctx.drawArrays(GL.immediate.mode, 0, numVertexes);
}
+ if (!GL.currArrayBuffer) {
+ Module.ctx.bindBuffer(Module.ctx.ARRAY_BUFFER, null);
+ }
+ if (!GL.currProgram) {
+ Module.ctx.useProgram(null);
+ }
+
this.vertexCounter = 0;
}
},
diff --git a/tests/runner.py b/tests/runner.py
index 0e1b4716..f3ad789f 100755
--- a/tests/runner.py
+++ b/tests/runner.py
@@ -7225,7 +7225,7 @@ elif 'browser' in str(sys.argv):
self.btest('sdlglshader.c', reference='sdlglshader.png')
def zzztest_cubegeom(self):
- self.btest('cubegeom.c', reference='sdlglshader.png')
+ self.btest('cubegeom.c', reference='sdlglshader.png', args=['-s', 'GL_DEBUG=1'])
elif 'benchmark' in str(sys.argv):
# Benchmarks. Run them with argument |benchmark|. To run a specific test, do