diff options
author | Alon Zakai <alonzakai@gmail.com> | 2012-05-08 17:36:08 -0700 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2012-05-08 17:36:08 -0700 |
commit | bc8dc3dbf22e3126b2314827041d2e55a5db5a04 (patch) | |
tree | 4329bca0c438b3491e417faa83dc8cbf8a669da1 /src/library_gl.js | |
parent | 2eee1b1cef854bf55f532bd29b9dc2d0737fffc3 (diff) |
make glBegin/end usage of client attributes safer
Diffstat (limited to 'src/library_gl.js')
-rw-r--r-- | src/library_gl.js | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/library_gl.js b/src/library_gl.js index c392d0d2..1c52e422 100644 --- a/src/library_gl.js +++ b/src/library_gl.js @@ -1282,6 +1282,9 @@ var LibraryGL = { addRendererComponent: function(name, size, type) { if (!this.rendererComponents[name]) { this.rendererComponents[name] = 1; +#if ASSERTIONS + assert(!this.enabledClientAttributes[this.ATTRIBUTE_BY_NAME[name]]); // cannot get mixed up with this, for example we will disable this later +#endif this.enabledClientAttributes[this.ATTRIBUTE_BY_NAME[name]] = true; this.setClientAttribute(name, size, type, 0, this.rendererComponentPointer); this.rendererComponentPointer += size * this.byteSizeByType[type]; @@ -1290,9 +1293,9 @@ var LibraryGL = { } }, - disableAllClientAttributes: function() { - for (var i = 0; i < this.NUM_ATTRIBUTES; i++) { - this.enabledClientAttributes[i] = 0; + disableBeginEndClientAttributes: function() { + for (var name in this.rendererComponents) { + this.enabledClientAttributes[this.ATTRIBUTE_BY_NAME[name]] = false; } }, @@ -1679,7 +1682,7 @@ var LibraryGL = { glEnd: function() { GL.immediate.prepareClientAttributes(GL.immediate.rendererComponents['V'], true); GL.immediate.flush(); - GL.immediate.disableAllClientAttributes(); + GL.immediate.disableBeginEndClientAttributes(); }, glVertex3f: function(x, y, z) { |