Skip to content

Commit 7bea69d

Browse files
committed
Enable canvas transparency
1 parent e4446ba commit 7bea69d

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/RenderWebGL.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ class RenderWebGL extends EventEmitter {
123123
try {
124124
optCanvas = optCanvas || document.createElement('canvas');
125125
const options = {
126-
alpha: false,
126+
alpha: true,
127127
stencil: true,
128128
antialias: false,
129129
powerPreference: RenderWebGL.powerPreference
@@ -148,7 +148,7 @@ class RenderWebGL extends EventEmitter {
148148
*/
149149
static _getContext (canvas) {
150150
const contextAttribs = {
151-
alpha: false,
151+
alpha: true,
152152
stencil: true,
153153
antialias: false,
154154
powerPreference: RenderWebGL.powerPreference
@@ -417,13 +417,15 @@ class RenderWebGL extends EventEmitter {
417417
* @param {number} red The red component for the background.
418418
* @param {number} green The green component for the background.
419419
* @param {number} blue The blue component for the background.
420+
* @param {number} alpha The alpha component for the background.
420421
*/
421-
setBackgroundColor (red, green, blue) {
422+
setBackgroundColor (red, green, blue, alpha=1) {
422423
this.dirty = true;
423424

424425
this._backgroundColor4f[0] = red;
425426
this._backgroundColor4f[1] = green;
426427
this._backgroundColor4f[2] = blue;
428+
this._backgroundColor4f[3] = alpha;
427429

428430
this._backgroundColor3b[0] = red * 255;
429431
this._backgroundColor3b[1] = green * 255;

0 commit comments

Comments
 (0)