From 1f84ed4f9d0cc61b4d77cbb1a0101d76a569b019 Mon Sep 17 00:00:00 2001 From: "luchen@google.com" Date: Tue, 27 Jul 2010 21:56:11 +0000 Subject: o3d-webgl: Adjusting Sampler to throw an error if client attempts to use BORDER as uv address mode (not supported in WebGL). Review URL: http://codereview.chromium.org/3038014 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@53855 0039d316-1c4b-4281-b951-d872f2087c98 --- o3d/samples/o3d-webgl-samples/shadow-map.html | 8 +++++--- o3d/samples/o3d-webgl-samples/texturesamplers.html | 8 ++++---- o3d/samples/o3d-webgl/sampler.js | 5 ++--- 3 files changed, 11 insertions(+), 10 deletions(-) (limited to 'o3d') diff --git a/o3d/samples/o3d-webgl-samples/shadow-map.html b/o3d/samples/o3d-webgl-samples/shadow-map.html index 7940410..97defe2 100644 --- a/o3d/samples/o3d-webgl-samples/shadow-map.html +++ b/o3d/samples/o3d-webgl-samples/shadow-map.html @@ -260,9 +260,11 @@ function initMaterials() { g_shadowSampler.minFilter = g_o3d.Sampler.POINT; g_shadowSampler.magFilter = g_o3d.Sampler.POINT; g_shadowSampler.mipFilter = g_o3d.Sampler.POINT; - g_shadowSampler.addressModeU = g_o3d.Sampler.BORDER; - g_shadowSampler.addressModeV = g_o3d.Sampler.BORDER; - g_shadowSampler.borderColor = [1, 1, 1, 1]; + // Note: The o3d-plugin used BORDER as address mode, but that is not available + // in WebGL so use WRAP instead. + g_shadowSampler.addressModeU = g_o3d.Sampler.WRAP; + g_shadowSampler.addressModeV = g_o3d.Sampler.WRAP; + //g_shadowSampler.borderColor = [1, 1, 1, 1]; } diff --git a/o3d/samples/o3d-webgl-samples/texturesamplers.html b/o3d/samples/o3d-webgl-samples/texturesamplers.html index 13fec25..bbf810e 100644 --- a/o3d/samples/o3d-webgl-samples/texturesamplers.html +++ b/o3d/samples/o3d-webgl-samples/texturesamplers.html @@ -185,10 +185,10 @@ function initStep2(clientElements) { samplers[1].minFilter = g_o3d.Sampler.ANISOTROPIC; samplers[1].maxAnisotropy = 4; - // Uses BORDER addressing mode with a red border. - samplers[2].addressModeU = g_o3d.Sampler.BORDER; - samplers[2].addressModeV = g_o3d.Sampler.BORDER; - samplers[2].borderColor = [1, 0, 0, 1]; + // Note: BORDER addressing is not supported in WebGL. + //samplers[2].addressModeU = g_o3d.Sampler.BORDER; + //samplers[2].addressModeV = g_o3d.Sampler.BORDER; + //samplers[2].borderColor = [1, 0, 0, 1]; // Uses POINT sampling for minification. samplers[3].addressModeU = g_o3d.Sampler.WRAP; diff --git a/o3d/samples/o3d-webgl/sampler.js b/o3d/samples/o3d-webgl/sampler.js index 4e651a9..e4d6513 100644 --- a/o3d/samples/o3d-webgl/sampler.js +++ b/o3d/samples/o3d-webgl/sampler.js @@ -180,10 +180,9 @@ o3d.Sampler.prototype.convertAddressMode_ = function(o3d_mode) { gl_mode = this.gl.CLAMP_TO_EDGE; break; case o3d.Sampler.BORDER: - gl_mode = this.gl.CLAMP_TO_BORDER; - break; + // This is not supported in WebGL. default: - this.gl.client.error_callback("Unknown Address mode"); + this.gl.client.error_callback("Unknown/Unavailable Address mode"); break; } return gl_mode; -- cgit v1.1