Skip to content

Commit

Permalink
Merge pull request jonobr1#413 from adroitwhiz/webgl-maskfix
Browse files Browse the repository at this point in the history
Premultiply WebGL alpha (redux)
  • Loading branch information
jonobr1 committed Dec 4, 2019
2 parents 79ad5b3 + 4c9ec17 commit d3bdeaa
Showing 1 changed file with 3 additions and 13 deletions.
16 changes: 3 additions & 13 deletions src/renderer/webgl.js
Original file line number Diff line number Diff line change
Expand Up @@ -145,9 +145,7 @@
});

if (this._mask) {

gl.disable(gl.STENCIL_TEST);

}

return this.flagReset();
Expand Down Expand Up @@ -1288,18 +1286,10 @@
// Setup some initial statements of the gl context
gl.enable(gl.BLEND);

// https://code.google.com/p/chromium/issues/detail?id=316393
gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, gl.TRUE);

gl.blendEquationSeparate(gl.FUNC_ADD, gl.FUNC_ADD);
gl.blendFuncSeparate(gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA,
gl.ONE, gl.ONE_MINUS_SRC_ALPHA);

// TODO: Fiddling with blend functions still required.
// gl.blendEquation(gl.FUNC_ADD);
// gl.blendFunc(gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA);

gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, true);

gl.blendEquation(gl.FUNC_ADD);
gl.blendFunc(gl.ONE, gl.ONE_MINUS_SRC_ALPHA);
};

_.extend(Renderer, {
Expand Down

0 comments on commit d3bdeaa

Please sign in to comment.