Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(569)

Unified Diff: samples/o3d-webgl/client.js

Issue 3047021: o3d-webgl: Allows non-opaque alpha channel for canvas clearColor (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/o3d/
Patch Set: '' Created 10 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: samples/o3d-webgl/client.js
===================================================================
--- samples/o3d-webgl/client.js (revision 53959)
+++ samples/o3d-webgl/client.js (working copy)
@@ -299,6 +299,16 @@
*/
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 @@
// 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);
+ }
};
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698