aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-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
},