Eye plane texgen

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?

Try the 3dlabs shadergen tool:-
http://developer.3dlabs.com/downloads/shadergen/

…then, if the shader generated by it doesn’t match the fixed pipeline, it’s a driver bug.

Hi I have the same problem. And I’ve used 3dlabs shadergen tool. The shader and the fixed pipeline image in the tool are the same. But when I use the shader in my app, the result is wrong. When I stick to fixed function pipeline the result is write. I suppose it is not a driver issue, because it is the same for nvidia and ati

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