aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEhsan Akhgari <ehsan.akhgari@gmail.com>2012-01-25 00:06:17 -0500
committerEhsan Akhgari <ehsan.akhgari@gmail.com>2012-01-25 00:06:17 -0500
commit4a26ed4670df89af0f1c98214fa99f71461ae0e3 (patch)
tree8a1dc2cabee6ed416a7b8d9dec1d679da7b4ef00
parent154c4b63f1876e2bcb73fa456b69c7e00795af66 (diff)
Adopt the black canvas background for SDL WebGL canvas as well
-rw-r--r--src/library_sdl.js5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/library_sdl.js b/src/library_sdl.js
index 511882dd..d438fc23 100644
--- a/src/library_sdl.js
+++ b/src/library_sdl.js
@@ -176,6 +176,11 @@ mergeInto(LibraryManager.library, {
try {
var ctx = Module.canvas.getContext(useWebGL ? 'experimental-webgl' : '2d');
if (!ctx) throw 'Could not create canvas :(';
+ if (useWebGL) {
+ // Set the background of the WebGL canvas to black, because SDL gives us a
+ // window which has a black background by default.
+ Module.canvas.style.backgroundColor = "black";
+ }
return Module.ctx = ctx;
} catch (e) {
Module.print('(canvas not available)');