Howdy. I’ve got a GLSL problem I need help with.
Basically I have a shader that operates on 5 active texture units & 5 texture coordinate sets. I’m pretty sure that all 5 texture units are properly activated on the code-side. I’m positive that all 5 texture coordinate sets are coming in. However, when I assign gl_TexCoord values for indices 0-4, the value in gl_TexCoord[0] basically overwrites what in one of my other, user-defined varying variables (in this case, normal).
I’ve stripped down my shaders to isolate the problem. The vertex program just sets a varying normal, and assigns 0-4 gl_TexCoord values. The fragment program just renders the value of the normal, which allows me to see that the register has been filled with the value of gl_TexCoord[0]. (I confirmed this by messing around with the 0th texture coordinate to see the results).
I’m going to keep looking into the code, because it really seems like the vertex program is mis-allocating the gl_TexCoord array, in a way such that gl_TexCoord[0] is aliasing my other varying register (normal).
In the meantime, if this problem rings any bells for anyone, please let me know.
varying vec3 normal_c;
void main()
{
normal_c = normalize(gl_NormalMatrix * gl_Normal);
gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;
gl_TexCoord[1] = gl_TextureMatrix[1] * gl_MultiTexCoord1;
gl_TexCoord[2] = gl_TextureMatrix[2] * gl_MultiTexCoord2;
gl_TexCoord[3] = gl_TextureMatrix[3] * gl_MultiTexCoord3;
gl_TexCoord[4] = gl_TextureMatrix[4] * gl_MultiTexCoord4;
gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
}
varying vec3 normal_c;
void main()
{
gl_FragColor = vec4(normal_c, 0.0);
}
