aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/library_browser.js1
-rw-r--r--src/library_gl.js2
2 files changed, 3 insertions, 0 deletions
diff --git a/src/library_browser.js b/src/library_browser.js
index d49c4103..e9860742 100644
--- a/src/library_browser.js
+++ b/src/library_browser.js
@@ -77,6 +77,7 @@ mergeInto(LibraryManager.library, {
}
if (setInModule) {
Module.ctx = ctx;
+ Module.useWebGL = useWebGL;
Browser.moduleContextCreatedCallbacks.forEach(function(callback) { callback() });
}
return ctx;
diff --git a/src/library_gl.js b/src/library_gl.js
index 3eba76d0..2be48ba1 100644
--- a/src/library_gl.js
+++ b/src/library_gl.js
@@ -1517,6 +1517,8 @@ var LibraryGL = {
Module.printErr('WARNING: using emscripten GL immediate mode emulation. This is very limited in what it supports');
GL.immediate.initted = true;
+ if (!Module.useWebGL) return; // a 2D canvas may be currently used TODO: make sure we are actually called in that case
+
this.matrixStack['m'] = [];
this.matrixStack['p'] = [];
for (var i = 0; i < GL.immediate.MAX_TEXTURES; i++) {