summaryrefslogtreecommitdiffstats
path: root/o3d/samples/o3d-webgl/effect.js
diff options
context:
space:
mode:
authorpetersont@google.com <petersont@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2010-08-29 02:56:15 +0000
committerpetersont@google.com <petersont@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2010-08-29 02:56:15 +0000
commit1fc0028e763b6fcfba140940fa33bdec0502a473 (patch)
tree523d836c073364782cb0fa172b4158d52002bec8 /o3d/samples/o3d-webgl/effect.js
parent41ffdc7bf92a79ca6d6b917ab943989185b9d1a0 (diff)
downloadchromium_src-1fc0028e763b6fcfba140940fa33bdec0502a473.zip
chromium_src-1fc0028e763b6fcfba140940fa33bdec0502a473.tar.gz
chromium_src-1fc0028e763b6fcfba140940fa33bdec0502a473.tar.bz2
Added capability for an error (default) cube map texture, so if a cube sampler doesn't have a texture associated with it, it doesn't choke WebGL.
Review URL: http://codereview.chromium.org/3162048 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@57808 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'o3d/samples/o3d-webgl/effect.js')
-rw-r--r--o3d/samples/o3d-webgl/effect.js18
1 files changed, 13 insertions, 5 deletions
diff --git a/o3d/samples/o3d-webgl/effect.js b/o3d/samples/o3d-webgl/effect.js
index 3d9f85e..f45dab0 100644
--- a/o3d/samples/o3d-webgl/effect.js
+++ b/o3d/samples/o3d-webgl/effect.js
@@ -229,7 +229,7 @@ o3d.Effect.prototype.loadVertexShaderFromString =
function(shaderString) {
var success =
this.loadShaderFromString(shaderString, this.gl.VERTEX_SHADER);
- this.vertexShaderLoaded_ = true;
+ this.vertexShaderLoaded_ = success;
o3d.Effect.prototype.bindAttributesAndLinkIfReady();
return success;
};
@@ -244,7 +244,7 @@ o3d.Effect.prototype.loadPixelShaderFromString =
function(shaderString) {
var success =
this.loadShaderFromString(shaderString, this.gl.FRAGMENT_SHADER);
- this.fragmentShaderLoaded_ = true;
+ this.fragmentShaderLoaded_ = success;
this.bindAttributesAndLinkIfReady();
return success;
};
@@ -260,8 +260,11 @@ o3d.Effect.prototype.loadPixelShaderFromString =
o3d.Effect.prototype.loadFromFXString =
function(shaderString) {
var splitIndex = shaderString.indexOf('// #o3d SplitMarker');
- return this.loadVertexShaderFromString(shaderString.substr(0, splitIndex)) &&
- this.loadPixelShaderFromString(shaderString.substr(splitIndex));
+ var vertexShaderString = shaderString.substr(0, splitIndex);
+ var pixelShaderString = shaderString.substr(splitIndex);
+ var result = this.loadVertexShaderFromString(vertexShaderString) &&
+ this.loadPixelShaderFromString(pixelShaderString);
+ return result;
};
@@ -409,6 +412,7 @@ o3d.Effect.reverseSemanticMap_ = [];
}
})();
+
/**
* For each of the effect's uniform parameters, creates corresponding
* parameters on the given ParamObject. Skips SAS Parameters.
@@ -552,7 +556,11 @@ o3d.Effect.prototype.searchForParams_ = function(object_list) {
if (uniformInfo.kind == o3d.Effect.ARRAY) {
param.applyToLocations(this.gl, uniformInfo.locations);
} else {
- param.applyToLocation(this.gl, uniformInfo.location);
+ if (uniformInfo.info.type == this.gl.SAMPLER_CUBE) {
+ param.applyToLocation(this.gl, uniformInfo.location, true);
+ } else {
+ param.applyToLocation(this.gl, uniformInfo.location);
+ }
}
filled_map[name] = true;
}