aboutsummaryrefslogtreecommitdiff
path: root/src
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 /src
parent0f5ed11b876c252edf5bf9e2716ff6096d4238d0 (diff)
clean up gl emulation flush, remove unneeded and incorrect bindings
Diffstat (limited to 'src')
-rw-r--r--src/library_gl.js18
1 files changed, 14 insertions, 4 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;
}
},