[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Public WebGL] debugging a shaderLinkError




I'm trying to figure out why I'm getting a shaderLink error running this on Windows in Chrome 9:

  http://visual-demos.dev.concord.org/seasons/earth/seasons1-2a.html

It works fine on my Mac..

The problem on Windows occurs on at least the following two cards:

Renderer: ATI Mobility Radeon HD 4250 Graphics
Vendor: ATI Technologies Inc.
Memory: 256 MB
Version: 3.2.9752 Forward-Compatible Context

Renderer: ATI Radeon HD 5400 Series
Vendor: ATI Technologies Inc.
Memory: 1024 MB
Version: 4.0.10317 Core Profile Forward-Compatible Context

I'm using the SceneJS framework  to generate the shaders.

What are the best ways to find out more about what is the trouble on Windows?

Here are the string values for the vertexShaderSrc and fragmentShaderSrc:

vertexShaderSrc =
"#ifdef GL_ES
   precision highp float;
#endif
attribute vec3 aVertex;
attribute vec3 aNormal;
uniform   mat4 uMNMatrix;
uniform   mat4 uVNMatrix;
varying   vec3 vNormal;
varying   vec3 vEyeVec;
uniform vec4 uLightPos0;
varying vec3 vLightVec0;
varying float vLightDist0;
uniform vec3 uLightDir1;
varying vec3 vLightVec1;
varying float vLightDist1;
uniform vec3 uLightDir2;
varying vec3 vLightVec2;
varying float vLightDist2;
uniform vec3 uLightDir3;
varying vec3 vLightVec3;
varying float vLightDist3;
uniform vec3 uLightDir4;
varying vec3 vLightVec4;
varying float vLightDist4;
uniform vec3 uLightDir5;
varying vec3 vLightVec5;
varying float vLightDist5;
uniform vec3 uLightDir6;
varying vec3 vLightVec6;
varying float vLightDist6;
uniform mat4 uMMatrix;
uniform mat4 uVMatrix;
uniform mat4 uPMatrix;
varying vec4 vViewVertex;
void main(void) {
  vec4 tmpVertex = uVMatrix * (uMMatrix * vec4(aVertex, 1.0));
  vec4 tmpNormal = uVNMatrix * (uMNMatrix * vec4(aNormal, 1.0));
  vNormal = normalize(tmpNormal.xyz);
  vViewVertex = tmpVertex;
  gl_Position = uPMatrix * vViewVertex;
  vec3 tmpVec;
tmpVec = -(uLightPos0.xyz - tmpVertex.xyz);
vLightDist0 = length(tmpVec);
vLightVec0 = tmpVec;
tmpVec = -uLightDir1;
vLightVec1 = tmpVec;
tmpVec = -uLightDir2;
vLightVec2 = tmpVec;
tmpVec = -uLightDir3;
vLightVec3 = tmpVec;
tmpVec = -uLightDir4;
vLightVec4 = tmpVec;
tmpVec = -uLightDir5;
vLightVec5 = tmpVec;
tmpVec = -uLightDir6;
vLightVec6 = tmpVec;
vEyeVec = normalize(-vViewVertex.xyz);
}"



fragmentShaderSrc =
"

#ifdef GL_ES
precision highp float;
#endif
varying vec4 vViewVertex;
uniform vec3 uMaterialBaseColor;
uniform float uMaterialAlpha;
uniform vec3 uAmbient;
uniform float uMaterialEmit;
vec3 ambientValue=uAmbient;
float emit = uMaterialEmit;
varying vec3 n;
varying vec3 vNormal;
varying vec3 vEyeVec;
uniform vec3 uMaterialSpecularColor;
uniform float uMaterialSpecular;
uniform float uMaterialShine;
uniform vec3 uLightColor0;
uniform vec4 uLightPos0;
uniform vec3 uLightAttenuation0;
varying vec3 vLightVec0;
varying float vLightDist0;
uniform vec3 uLightColor1;
uniform vec3 uLightDir1;
uniform vec3 uLightAttenuation1;
varying vec3 vLightVec1;
varying float vLightDist1;
uniform vec3 uLightColor2;
uniform vec3 uLightDir2;
uniform vec3 uLightAttenuation2;
varying vec3 vLightVec2;
varying float vLightDist2;
uniform vec3 uLightColor3;
uniform vec3 uLightDir3;
uniform vec3 uLightAttenuation3;
varying vec3 vLightVec3;
varying float vLightDist3;
uniform vec3 uLightColor4;
uniform vec3 uLightDir4;
uniform vec3 uLightAttenuation4;
varying vec3 vLightVec4;
varying float vLightDist4;
uniform vec3 uLightColor5;
uniform vec3 uLightDir5;
uniform vec3 uLightAttenuation5;
varying vec3 vLightVec5;
varying float vLightDist5;
uniform vec3 uLightColor6;
uniform vec3 uLightDir6;
uniform vec3 uLightAttenuation6;
varying vec3 vLightVec6;
varying float vLightDist6;
void main(void) {
vec3 color = uMaterialBaseColor;
float alpha = uMaterialAlpha;
float specular=uMaterialSpecular;
vec3 specularColor=uMaterialSpecularColor;
float shine=uMaterialShine;
float attenuation = 1.0;
vec3 normalVec=vNormal;
vec3 lightValue = uAmbient;
vec3 specularValue = vec3(0.0, 0.0, 0.0);
vec3 lightVec;
float dotN;
float spotFactor;
float pf;
lightVec = normalize(vLightVec0);
dotN = max(dot(normalVec, lightVec),0.0);
if (dotN > 0.0) {
attenuation = 1.0 / ( uLightAttenuation0[0] + uLightAttenuation0[1] * vLightDist0 + uLightAttenuation0[2] * vLightDist0 * vLightDist0);
lightValue += dotN * uLightColor0 * attenuation;
specularValue += attenuation * specularColor * uLightColor0 * specular * pow(max(dot(reflect(lightVec, normalVec), vEyeVec),0.0), shine);
}
lightVec = normalize(vLightVec1);
dotN = max(dot(normalVec,lightVec),0.0);
lightValue += dotN * uLightColor1;
specularValue += specularColor * uLightColor1 * specular * pow(max(dot(reflect(lightVec, normalVec),normalize(vEyeVec)),0.0), shine);
lightVec = normalize(vLightVec2);
dotN = max(dot(normalVec,lightVec),0.0);
lightValue += dotN * uLightColor2;
specularValue += specularColor * uLightColor2 * specular * pow(max(dot(reflect(lightVec, normalVec),normalize(vEyeVec)),0.0), shine);
lightVec = normalize(vLightVec3);
dotN = max(dot(normalVec,lightVec),0.0);
lightValue += dotN * uLightColor3;
specularValue += specularColor * uLightColor3 * specular * pow(max(dot(reflect(lightVec, normalVec),normalize(vEyeVec)),0.0), shine);
lightVec = normalize(vLightVec4);
dotN = max(dot(normalVec,lightVec),0.0);
lightValue += dotN * uLightColor4;
specularValue += specularColor * uLightColor4 * specular * pow(max(dot(reflect(lightVec, normalVec),normalize(vEyeVec)),0.0), shine);
lightVec = normalize(vLightVec5);
dotN = max(dot(normalVec,lightVec),0.0);
lightValue += dotN * uLightColor5;
specularValue += specularColor * uLightColor5 * specular * pow(max(dot(reflect(lightVec, normalVec),normalize(vEyeVec)),0.0), shine);
lightVec = normalize(vLightVec6);
dotN = max(dot(normalVec,lightVec),0.0);
lightValue += dotN * uLightColor6;
specularValue += specularColor * uLightColor6 * specular * pow(max(dot(reflect(lightVec, normalVec),normalize(vEyeVec)),0.0), shine);
if (emit>0.0) lightValue = vec3(1.0, 1.0, 1.0);
vec4 fragColor = vec4(specularValue.rgb + color.rgb * (emit+1.0) * lightValue.rgb, alpha);
gl_FragColor = fragColor;
}"


-----------------------------------------------------------
You are currently subscribed to public_webgl@khronos.org.
To unsubscribe, send an email to majordomo@khronos.org with
the following command in the body of your email:
unsubscribe public_webgl
-----------------------------------------------------------