aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2012-06-01 17:03:52 -0700
committerAlon Zakai <alonzakai@gmail.com>2012-06-01 17:03:52 -0700
commit82621215747b6655e1e14bb0531ac39528969100 (patch)
treed36da6bfcdbde373575199e416d46867d2adcd96
parent492562885177a6741dd7ce333869eae4933b04b6 (diff)
fix drawArrays emulated buffer size calculation
-rw-r--r--src/library_gl.js9
1 files changed, 2 insertions, 7 deletions
diff --git a/src/library_gl.js b/src/library_gl.js
index 1bd37d00..2abb3002 100644
--- a/src/library_gl.js
+++ b/src/library_gl.js
@@ -1656,12 +1656,7 @@ var LibraryGL = {
if (!GL.currElementArrayBuffer) {
// If no element array buffer is bound, then indices is a literal pointer to clientside data
Module.ctx.bindBuffer(Module.ctx.ELEMENT_ARRAY_BUFFER, this.indexObject);
- var clientDataSize;
- switch(GL.immediate.mode) {
- case 4: clientDataSize = 3*numProvidedIndexes; break; // GL_TRIANGLES
- default: throw 'Unhandled clientside array for glDrawElements: ' + mode;
- }
- Module.ctx.bufferSubData(Module.ctx.ELEMENT_ARRAY_BUFFER, 0, {{{ makeHEAPView('U16', 'startIndex', 'startIndex + clientDataSize') }}});
+ Module.ctx.bufferSubData(Module.ctx.ELEMENT_ARRAY_BUFFER, 0, {{{ makeHEAPView('U16', 'startIndex', 'startIndex + numProvidedIndexes*2') }}});
startIndex = 0;
emulatedElementArrayBuffer = true;
}
@@ -1936,7 +1931,7 @@ var LibraryGL = {
glLoadMatrixf: function(matrix) {
#if GL_DEBUG
- Module.printErr('glLoadMatrixf receiving: ' + Array.prototype.slice.call(HEAPF32.subarray(matrix >> 2, (matrix >> 2) + 16)));
+ if (GL.debug) Module.printErr('glLoadMatrixf receiving: ' + Array.prototype.slice.call(HEAPF32.subarray(matrix >> 2, (matrix >> 2) + 16)));
#endif
GL.immediate.matrix.lib.mat4.set({{{ makeHEAPView('F32', 'matrix', 'matrix+16*4') }}}, GL.immediate.matrix[GL.immediate.currentMatrix]);
},