aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2012-04-30 15:36:35 -0700
committerAlon Zakai <alonzakai@gmail.com>2012-04-30 15:36:35 -0700
commit1943a11a77d6870ee3b227bf4be1b619ed66719b (patch)
tree39e7ae16b8633457075ebd39843ed5a6a0a87a68
parentbcaf98582784d114d616067bcfb304e4037ec19f (diff)
clean up activated vertex attrib arrays in renderers, fixes bug with only 1/4 of the world drawn in bananabread
-rw-r--r--src/library_gl.js9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/library_gl.js b/src/library_gl.js
index 766c0557..35d73684 100644
--- a/src/library_gl.js
+++ b/src/library_gl.js
@@ -1381,6 +1381,13 @@ var LibraryGL = {
Module.ctx.bindTexture(Module.ctx.TEXTURE_2D, texture);
Module.ctx.uniform1i(this.textureLocation, 0);
}
+ },
+
+ cleanup: function() {
+ Module.ctx.disableVertexAttribArray(this.positionLocation);
+ if (this.hasTexture) {
+ Module.ctx.disableVertexAttribArray(this.texCoordLocation);
+ }
}
};
ret.init();
@@ -1532,6 +1539,8 @@ var LibraryGL = {
Module.ctx.drawArrays(GL.immediate.mode, startIndex, numVertexes);
}
+ renderer.cleanup();
+
if (!GL.currArrayBuffer) {
Module.ctx.bindBuffer(Module.ctx.ARRAY_BUFFER, null);
}