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-03-12 21:00:00 +0000
committerpetersont@google.com <petersont@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-12 21:00:00 +0000
commite512583b79e366db399a6566964412bb6e5af823 (patch)
treee15e3c05e273a0366caf2fcbc5689ae377b3e877 /o3d/samples/o3d-webgl/effect.js
parenta37a999f87eed77b08e7e1b6bdb86d406f31ea9b (diff)
downloadchromium_src-e512583b79e366db399a6566964412bb6e5af823.zip
chromium_src-e512583b79e366db399a6566964412bb6e5af823.tar.gz
chromium_src-e512583b79e366db399a6566964412bb6e5af823.tar.bz2
Added textures, texture samplers and render targets to o3d-webgl. Also fixed bugs, added calls to parent class constructor to classes that didn't have them before, added a few demos to exhibit/test textures and render surfaces.
Review URL: http://codereview.chromium.org/856004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@41482 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'o3d/samples/o3d-webgl/effect.js')
-rw-r--r--o3d/samples/o3d-webgl/effect.js54
1 files changed, 34 insertions, 20 deletions
diff --git a/o3d/samples/o3d-webgl/effect.js b/o3d/samples/o3d-webgl/effect.js
index 53d8882..f8d7dc5 100644
--- a/o3d/samples/o3d-webgl/effect.js
+++ b/o3d/samples/o3d-webgl/effect.js
@@ -89,6 +89,7 @@ o3d.EffectParameterInfo.prototype.sas_class_name = '';
* @constructor
*/
o3d.EffectStreamInfo = function(opt_semantic, opt_semantic_index) {
+ o3d.NamedObject.call(this);
if (!opt_semantic) {
opt_semantic = o3d.Stream.UNKNOWN_SEMANTIC;
}
@@ -176,6 +177,13 @@ o3d.Effect.prototype.loadShaderFromString = function(shaderString, type) {
var shader = this.gl.createShader(type);
this.gl.shaderSource(shader, shaderString);
this.gl.compileShader(shader);
+
+ var log = this.gl.getShaderInfoLog(shader);
+ if (log != '') {
+ this.gl.client.error_callback(
+ 'Shader compile failed with error log:\n' + log);
+ }
+
this.gl.attachShader(this.program_, shader);
};
@@ -245,24 +253,24 @@ o3d.Effect.prototype.createUniformParameters =
'worldView': true,
'worldProjection': true,
'worldViewProjection': true,
- 'worldI': true,
- 'viewI': true,
- 'projectionI': true,
- 'worldViewI': true,
- 'worldProjectionI': true,
- 'worldViewProjectionI': true,
- 'worldT': true,
- 'viewT': true,
- 'projectionT': true,
- 'worldViewT': true,
- 'worldProjectionT': true,
- 'worldViewProjectionT': true,
- 'worldIT': true,
- 'viewIT': true,
- 'projectionIT': true,
- 'worldViewIT': true,
- 'worldProjectionIT': true,
- 'worldViewProjectionIT': true};
+ 'worldInverse': true,
+ 'viewInverse': true,
+ 'projectionInverse': true,
+ 'worldViewInverse': true,
+ 'worldProjectionInverse': true,
+ 'worldViewProjectionInverse': true,
+ 'worldTranspose': true,
+ 'viewTranspose': true,
+ 'projectionTranspose': true,
+ 'worldViewTranspose': true,
+ 'worldProjectionTranspose': true,
+ 'worldViewProjectionTranspose': true,
+ 'worldInverseTranspose': true,
+ 'viewInverseTranspose': true,
+ 'projectionInverseTranspose': true,
+ 'worldViewInverseTranspose': true,
+ 'worldProjectionInverseTranspose': true,
+ 'worldViewProjectionInverseTranspose': true};
for (name in this.uniforms) {
var info = this.uniforms[name].info;
@@ -330,7 +338,7 @@ o3d.Effect.prototype.createSASParameters =
/**
* Gets info about the parameters this effect needs.
- * @returns {!Array.<!o3d.EffectParameterInfo>} an array of
+ * @return {!Array.<!o3d.EffectParameterInfo>} an array of
* EffectParameterInfo objects.
*/
o3d.Effect.prototype.getParameterInfo = function() {
@@ -341,7 +349,7 @@ o3d.Effect.prototype.getParameterInfo = function() {
/**
* Gets info about the streams this effect needs.
- * @returns {!Array.<!o3d.EffectStreamInfo>} an array of
+ * @return {!Array.<!o3d.EffectStreamInfo>} an array of
* EffectStreamInfo objects.
*/
o3d.Effect.prototype.getStreamInfo = function() {
@@ -390,6 +398,12 @@ o3d.Effect.prototype.searchForParams = function(object_list) {
}
}
}
+
+ for (name in this.uniforms) {
+ if (!filled_map[name]) {
+ throw ('Uniform param not filled: '+name);
+ }
+ }
};