summaryrefslogtreecommitdiffstats
path: root/o3d
diff options
context:
space:
mode:
authorluchen@google.com <luchen@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2010-07-28 23:03:01 +0000
committerluchen@google.com <luchen@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2010-07-28 23:03:01 +0000
commit1e2f469059e20a79c51ab72de1b014fd1a217eda (patch)
tree2531d6cd32735b8f11589efdac260661fab7fc24 /o3d
parentdcfc4dd555f18663899e82ee4ae0d99a7198ec5f (diff)
downloadchromium_src-1e2f469059e20a79c51ab72de1b014fd1a217eda.zip
chromium_src-1e2f469059e20a79c51ab72de1b014fd1a217eda.tar.gz
chromium_src-1e2f469059e20a79c51ab72de1b014fd1a217eda.tar.bz2
Review URL: http://codereview.chromium.org/3047021
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@54060 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'o3d')
-rw-r--r--o3d/samples/o3d-webgl/client.js18
1 files changed, 15 insertions, 3 deletions
diff --git a/o3d/samples/o3d-webgl/client.js b/o3d/samples/o3d-webgl/client.js
index ebbcb8f..3fd450f 100644
--- a/o3d/samples/o3d-webgl/client.js
+++ b/o3d/samples/o3d-webgl/client.js
@@ -299,6 +299,16 @@ o3d.Client.prototype.packs_ = [];
*/
o3d.Client.prototype.counter_manager_ = null;
+/**
+ * Whether or not the client sets the alpha channel of all pixels to 1 in the
+ * final stage of rendering.
+ *
+ * By default, this is set to true to mimic the plugin's behavior. If
+ * a transparent canvas background is desirable, this should be set to false.
+ *
+ * @type {boolean}
+ */
+o3d.Client.prototype.normalizeClearColorAlpha = true;
/**
* Function that gets called when the client encounters an error.
@@ -472,9 +482,11 @@ o3d.Client.prototype.render = function() {
// 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);
+ if (this.normalizeClearColorAlpha) {
+ 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);
+ }
};