diff options
author | petersont@google.com <petersont@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-05-19 00:54:42 +0000 |
---|---|---|
committer | petersont@google.com <petersont@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-05-19 00:54:42 +0000 |
commit | e0ff76cbf4da96d50306e3a4ef9bf6bef0ecd399 (patch) | |
tree | 935563e7e45b603c5ff41880fa3cc60068055427 /o3d/samples | |
parent | 79b15b23db23e5c7722258d0b227959be7ac387c (diff) | |
download | chromium_src-e0ff76cbf4da96d50306e3a4ef9bf6bef0ecd399.zip chromium_src-e0ff76cbf4da96d50306e3a4ef9bf6bef0ecd399.tar.gz chromium_src-e0ff76cbf4da96d50306e3a4ef9bf6bef0ecd399.tar.bz2 |
The z-sorting sample looked tinted gray because of the final alpha channel copying to the screen. Fixing this revealed that the sort was actually broken in a different way as well, so I fixed that, too.
Review URL: http://codereview.chromium.org/2074015
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@47606 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'o3d/samples')
-rw-r--r-- | o3d/samples/o3d-webgl/client.js | 10 | ||||
-rw-r--r-- | o3d/samples/o3d-webgl/draw_list.js | 8 | ||||
-rw-r--r-- | o3d/samples/o3d-webgl/transform.js | 4 |
3 files changed, 16 insertions, 6 deletions
diff --git a/o3d/samples/o3d-webgl/client.js b/o3d/samples/o3d-webgl/client.js index cef816b..9d846c1 100644 --- a/o3d/samples/o3d-webgl/client.js +++ b/o3d/samples/o3d-webgl/client.js @@ -438,7 +438,17 @@ o3d.Client.prototype.render = function() { this.render_callback(render_event); } this.then_ = now; + + this.gl.colorMask(true, true, true, true); + this.renderTree(this.renderGraphRoot); + + // When o3d finally draws to the webpage, the alpha channel should be all 1's + // So we clear with a color mask to set all alpha bytes to 1 before drawing. + // Before we draw again, the color mask gets set back to all true (above). + this.gl.colorMask(false, false, false, true); + this.gl.clearColor(0.0, 0.0, 0.0, 1.0); + this.gl.clear(this.gl.COLOR_BUFFER_BIT); }; diff --git a/o3d/samples/o3d-webgl/draw_list.js b/o3d/samples/o3d-webgl/draw_list.js index 6132a8b..a9fa9ee 100644 --- a/o3d/samples/o3d-webgl/draw_list.js +++ b/o3d/samples/o3d-webgl/draw_list.js @@ -84,11 +84,11 @@ o3d.DrawList.comparePriority_ = function(drawElementInfoA, drawElementInfoB) { */ o3d.DrawList.compareZ_ = function(drawElementInfoA, drawElementInfoB) { return o3d.Transform.transformPointZOnly( - drawElementInfoA.worldViewProjection, - drawElementInfoA.drawElement.owner.zSortPoint) - - o3d.Transform.transformPointZOnly( drawElementInfoB.worldViewProjection, - drawElementInfoB.drawElement.owner.zSortPoint); + drawElementInfoB.drawElement.owner.zSortPoint) - + o3d.Transform.transformPointZOnly( + drawElementInfoA.worldViewProjection, + drawElementInfoA.drawElement.owner.zSortPoint); }; diff --git a/o3d/samples/o3d-webgl/transform.js b/o3d/samples/o3d-webgl/transform.js index 6499da2..5c35a80 100644 --- a/o3d/samples/o3d-webgl/transform.js +++ b/o3d/samples/o3d-webgl/transform.js @@ -641,8 +641,8 @@ o3d.Transform.transformPointZOnly = function(m, v) { var m2 = m[2]; var m3 = m[3]; - var d = (v0 * m0[2] + v1 * m1[2] + v2 * m2[2] + m3[2]) / - (v0 * m0[3] + v1 * m1[3] + v2 * m2[3] + m3[3]); + return (v0 * m0[2] + v1 * m1[2] + v2 * m2[2] + m3[2]) / + (v0 * m0[3] + v1 * m1[3] + v2 * m2[3] + m3[3]); }; |