aboutsummaryrefslogtreecommitdiff
path: root/src/library_browser.js
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2012-05-05 18:05:42 -0700
committerAlon Zakai <alonzakai@gmail.com>2012-05-05 18:05:42 -0700
commit642819024e8bef56119d37a34394bf85397d777c (patch)
tree2b19918faeb5508cbb220d788b4a88cec113e9aa /src/library_browser.js
parentd24edd5719c6156fc3223cf4cd4e4e2b9fc3a171 (diff)
refactor gl code for closure compiler, and add more testing
Diffstat (limited to 'src/library_browser.js')
-rw-r--r--src/library_browser.js7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/library_browser.js b/src/library_browser.js
index b2ec0869..ca4524a7 100644
--- a/src/library_browser.js
+++ b/src/library_browser.js
@@ -5,8 +5,9 @@
mergeInto(LibraryManager.library, {
$Browser: {
pointerLock: false,
+ moduleContextCreatedCallbacks: [],
- createContext: function(canvas, useWebGL) {
+ createContext: function(canvas, useWebGL, setInModule) {
#if !USE_TYPED_ARRAYS
if (useWebGL) {
Module.print('(USE_TYPED_ARRAYS needs to be enabled for WebGL)');
@@ -63,6 +64,10 @@ mergeInto(LibraryManager.library, {
// Set the background of the WebGL canvas to black
canvas.style.backgroundColor = "black";
}
+ if (setInModule) {
+ Module.ctx = ctx;
+ Browser.moduleContextCreatedCallbacks.forEach(function(callback) { callback() });
+ }
return ctx;
},