diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/library_browser.js | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/library_browser.js b/src/library_browser.js index 544ba4dc..b3e0a048 100644 --- a/src/library_browser.js +++ b/src/library_browser.js @@ -262,6 +262,8 @@ mergeInto(LibraryManager.library, { return null; } #endif + if (useWebGL && Module.ctx) return Module.ctx; // no need to recreate singleton GL context + var ctx; var errorInfo = '?'; function onContextCreationError(event) { @@ -391,7 +393,9 @@ mergeInto(LibraryManager.library, { canvas.style.backgroundColor = "black"; } if (setInModule) { - GLctx = Module.ctx = ctx; + if (!useWebGL) assert(typeof GLctx === 'undefined', 'cannot set in module if GLctx is used, but we are a non-GL context that would replace it'); + Module.ctx = ctx; + if (useWebGL) GLctx = ctx; Module.useWebGL = useWebGL; Browser.moduleContextCreatedCallbacks.forEach(function(callback) { callback() }); Browser.init(); |