-
Junior Member
Regular Contributor
Uniform in GLSL
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
-
Junior Member
Regular Contributor
Re: Uniform in GLSL
Hum, no answer... I didn't think it was a though one...
The easy version of the question would be: Am I the only not being able to control uniforms?
Vincent
-
Advanced Member
Frequent Contributor
Re: Uniform in GLSL
where is this 'nTex' coming from that you are using as an index to gl_TexCoord[] and into your nTextureIdx[] array?
-
Re: Uniform in GLSL
Could you post a test app? Or would that be impractical?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules