Skip to content

Commit

Permalink
Premultiply WebGL alpha
Browse files Browse the repository at this point in the history
  • Loading branch information
adroitwhiz committed Dec 4, 2019
1 parent ffbf48d commit 8e32a99
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 51 deletions.
18 changes: 4 additions & 14 deletions build/two.js
Original file line number Diff line number Diff line change
Expand Up @@ -472,7 +472,7 @@ SOFTWARE.
* @name Two.PublishDate
* @property {String} - The automatically generated publish date in the build process to verify version release candidates.
*/
PublishDate: '2019-12-04T10:23:43+01:00',
PublishDate: '2019-12-04T05:29:49-05:00',

/**
* @name Two.Identifier
Expand Down Expand Up @@ -6979,9 +6979,7 @@ SOFTWARE.
});

if (this._mask) {

gl.disable(gl.STENCIL_TEST);

}

return this.flagReset();
Expand Down Expand Up @@ -8122,18 +8120,10 @@ SOFTWARE.
// 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
Loading

0 comments on commit 8e32a99

Please sign in to comment.