I have a problem in GLSL. My uniform never seem to make it through to vertex or fragment shader.
Here is my fragment Shader:
uniform int nTexEnvMode0;
uniform sampler2D nTextIdx[8];
void main(void)
{
vec4 texval;
gl_FragColor = gl_Color;
if (nTexEnvMode0 == 1)
{
texval = texture2D(nTextIdx[nTex], vec2(gl_TexCoord[nTex]));
gl_FragColor *= texval;
}
};
As you can see, this is a very basic shader trying to apply a texture if my uniform is set.
I set it the following way:
int nTexEnvMode0Location = glGetUniformLocationARB( nProgramObject, “nTexEnvMode0”);
glUniform1iARB( nTexEnvMode0Location, 1 );
To me this should set the label nTexEnvMode0 to a permanent value of 1 since I don’t change it afterward. But it doesn’t work. It remains untexture, but the behaviour is fine if I force nTexEnvMode0 to 1 inside my shader, which prooves the problem is with the uniform.
Am I doing anything wrong?
BTW I’m using a GeForce 5900 Ultra with the latest driver.
Thanks