aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2012-05-10 12:09:52 -0700
committerAlon Zakai <alonzakai@gmail.com>2012-05-10 12:09:52 -0700
commita1b5373d498add24f4a0307d1786feffdd4caf78 (patch)
treee4e0854a95fe71bd97b643615111851b9b4ce4ab
parenta7ef69ec6fd292e2252424743b0a0dc9ed67f89f (diff)
use emulation on dlDrawArrays and Elements even if there are no client attributes, if the mode is a non-webgl one and we need to emulate it (like GL_QUADS)
-rw-r--r--src/library_gl.js8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/library_gl.js b/src/library_gl.js
index 0f7d251c..374ba9e5 100644
--- a/src/library_gl.js
+++ b/src/library_gl.js
@@ -1534,9 +1534,11 @@ var LibraryGL = {
this.clientColor = new Float32Array([1, 1, 1, 1]);
- // Replace some functions with immediate-mode aware versions
+ // Replace some functions with immediate-mode aware versions. If there are no client
+ // attributes enabled, and we use webgl-friendly modes (no GL_QUADS), then no need
+ // for emulation
_glDrawArrays = function(mode, first, count) {
- if (GL.immediate.totalEnabledClientAttributes == 0) {
+ if (GL.immediate.totalEnabledClientAttributes == 0 && mode <= 6) {
Module.ctx.drawArrays(mode, first, count);
return;
}
@@ -1546,7 +1548,7 @@ var LibraryGL = {
};
_glDrawElements = function(mode, count, type, indices) {
- if (GL.immediate.totalEnabledClientAttributes == 0) {
+ if (GL.immediate.totalEnabledClientAttributes == 0 && mode <= 6) {
Module.ctx.drawElements(mode, count, type, indices);
return;
}