aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2013-03-07 15:32:16 -0800
committerAlon Zakai <alonzakai@gmail.com>2013-03-07 15:32:16 -0800
commit85b35ffa059457284f5da9f773a9f5e8b6213d99 (patch)
treee5ab09b52f851b54fb16662a81e2dca697976f52
parent1951e2b8039e5744567059ce58050bf8201df2c2 (diff)
use temp buffers for indices in glDrawElements in FULL_ES2
-rw-r--r--src/library_gl.js6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/library_gl.js b/src/library_gl.js
index 84bb10d9..bbcd33a2 100644
--- a/src/library_gl.js
+++ b/src/library_gl.js
@@ -2935,10 +2935,11 @@ var LibraryGL = {
#if FULL_ES2
var buf;
if (!GL.currElementArrayBuffer) {
- buf = Module.ctx.createBuffer();
+ var size = GL.calcBufLength(1, type, 0, count);
+ buf = GL.tempIndexBuffers[GL.tempBufferIndexLookup[size]];
Module.ctx.bindBuffer(Module.ctx.ELEMENT_ARRAY_BUFFER, buf);
Module.ctx.bufferData(Module.ctx.ELEMENT_ARRAY_BUFFER,
- HEAPU8.subarray(indices, indices + GL.calcBufLength(1, type, 0, count)),
+ HEAPU8.subarray(indices, indices + size),
Module.ctx.DYNAMIC_DRAW);
// the index is now 0
indices = 0;
@@ -2955,7 +2956,6 @@ var LibraryGL = {
if (!GL.currElementArrayBuffer) {
Module.ctx.bindBuffer(Module.ctx.ELEMENT_ARRAY_BUFFER, null);
- Module.ctx.deleteBuffer(buf);
}
#endif
},