vince
12-22-2005, 12:41 PM
I'm trying to create a shader that would do the same thing than an texgen using eye plane mode in regular OpenGL. For some reason the following shader function doesn't work...
void fnSpotTexGen(int nL)
{
vec4 vertEye2 = gl_ModelViewMatrix * gl_Vertex;
gl_TexCoord[nL].s = dot(gl_EyePlaneS[nL],vertEye2);
gl_TexCoord[nL].t = dot(gl_EyePlaneT[nL],vertEye2);
gl_TexCoord[nL].p = dot(gl_EyePlaneR[nL],vertEye2);
gl_TexCoord[nL].q = dot(gl_EyePlaneQ[nL],vertEye2);
}
If I hardcode gl_TexCoord[nL].q, I get "almost" the same results than regular OpenGL. Any clue on what's wrong with this texgen?
void fnSpotTexGen(int nL)
{
vec4 vertEye2 = gl_ModelViewMatrix * gl_Vertex;
gl_TexCoord[nL].s = dot(gl_EyePlaneS[nL],vertEye2);
gl_TexCoord[nL].t = dot(gl_EyePlaneT[nL],vertEye2);
gl_TexCoord[nL].p = dot(gl_EyePlaneR[nL],vertEye2);
gl_TexCoord[nL].q = dot(gl_EyePlaneQ[nL],vertEye2);
}
If I hardcode gl_TexCoord[nL].q, I get "almost" the same results than regular OpenGL. Any clue on what's wrong with this texgen?