aboutsummaryrefslogtreecommitdiff
path: root/src/library_browser.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/library_browser.js')
-rw-r--r--src/library_browser.js20
1 files changed, 15 insertions, 5 deletions
diff --git a/src/library_browser.js b/src/library_browser.js
index dd60a581..59d2945e 100644
--- a/src/library_browser.js
+++ b/src/library_browser.js
@@ -225,7 +225,7 @@ mergeInto(LibraryManager.library, {
}
},
- createContext: function(canvas, useWebGL, setInModule) {
+ createContext: function(canvas, useWebGL, setInModule, webGLContextAttributes) {
#if !USE_TYPED_ARRAYS
if (useWebGL) {
Module.print('(USE_TYPED_ARRAYS needs to be enabled for WebGL)');
@@ -235,12 +235,22 @@ mergeInto(LibraryManager.library, {
var ctx;
try {
if (useWebGL) {
- ctx = canvas.getContext('experimental-webgl', {
+ var contextAttributes = {
+ antialias: false,
+ alpha: false
+ };
+
+ if (webGLContextAttributes) {
+ for (var attribute in webGLContextAttributes) {
+ contextAttributes[attribute] = webGLContextAttributes[attribute];
+ }
+ }
+
#if GL_TESTING
- preserveDrawingBuffer: true,
+ contextAttributes.preserveDrawingBuffer = true;
#endif
- alpha: false
- });
+
+ ctx = canvas.getContext('experimental-webgl', contextAttributes);
} else {
ctx = canvas.getContext('2d');
}