GLSL and nVidia issue

Well, the title says almost all.

I’m using shader to simulate bumpmapping and lightmap, it worked ok in my ATI card, but when I tried to run it in nVidia cards, it crashed. I even tried in a IGFX and it worked.
first I thought it was an application error, but then when I “propousitadely” make a mistake which will make the shader not compile (consequently, not used), and them, no crash.

Now the tricky part:
There is other models which shader works. That model already uses the bumpmap, but no lightmap. and it worked. So I thought it was a lightmap issue, so I deactivated it and tried again, and then I still got the problem! And it only happens in nVidia.

Vertex Shader:


uniform sampler2D mainTexture;
uniform sampler2D normalTexture;
uniform sampler2D lightTexture;
varying vec3 normal;

void main()
{
gl_TexCoord[0] = gl_MultiTexCoord0;
gl_TexCoord[1] = gl_MultiTexCoord2;


normal = normalize(gl_NormalMatrix * gl_Normal);
gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;

}

*ps: before I was using gl_TexCoord[2] = gl_MultiTexCoord2; but some one told me to never do that. I don’t understand why, in any case, I got the same error.

frag shader:


uniform sampler2D mainTexture;
uniform sampler2D normalTexture;
uniform sampler2D lightTexture;
varying vec3 normal;

void main()
{
vec3 normalMap = normalize(texture2D(normalTexture, gl_TexCoord[0].st).rgb * 2.0 - 1.0);
vec4 base = vec4(texture2D(mainTexture, gl_TexCoord[0].st).rgb,1.0);
vec4 lightMap = vec4(texture2D(lightTexture, gl_TexCoord[1].st).rgb,1.0);
float BaseNormal = max(dot(reflect(-vec3(0.5,1.0,0.5),normalMap),normalMap),0.0);

vec3 finalColor = base.xyz*lightMap.xyz;
finalColor *= BaseNormal;


gl_FragColor = vec4(finalColor,1.0);
}

well, that’s it, any ideia or tests for me to do?

Regards,

What GLSL compiler errors do you get? Any GL errors?

no errors, the application crash in nVidia cards, the same shader runs nice on ATI and IGFX cards…

Any Ideias?

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.