diff options
author | Alon Zakai <alonzakai@gmail.com> | 2014-06-19 17:48:26 -0700 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2014-06-19 17:48:26 -0700 |
commit | 41823148baaac2cf6cf700f4c19f3107de6f9592 (patch) | |
tree | db7d4e5681ec37ddce4c761581a3389d055899bb | |
parent | c7a6dd4ab312a91d218a99a017dea29d8d62941c (diff) |
do not recreate GL context
-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(); |