diff options
author | Rémi Papillié <remi.papillie@gmail.com> | 2013-10-07 00:22:52 +0200 |
---|---|---|
committer | Remi Papillie <remi.papillie@gmail.com> | 2013-10-13 12:41:26 +0200 |
commit | 2a9d0ee1ee287a8a483740a326fd5af19c70d66a (patch) | |
tree | 256445e07b6031d492163127e420c68bbc0836dc /src | |
parent | 250b58cb097921fe9a13b2a217e56d339c152a17 (diff) |
Switched off antialiasing by default for WebGL contexts.
Allowed customization of context attributes through Browser.createContext().
Diffstat (limited to 'src')
-rw-r--r-- | src/library_browser.js | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/src/library_browser.js b/src/library_browser.js index dd60a581..1c2f2e7f 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'); } |