PDA

View Full Version : GL_EYE_LINEAR in a vertex program



JWeaver
06-24-2002, 06:18 AM
I am trying to implement GL_EYE_LINEAR texgen in a vertex program. For each s, t, q, and r, I am replacing:
glTexGenfv(GL_S, GL_EYE_PLANE, p);
with (cMatrix is modelview matrix inverted):
p = p * cMatrix;
glProgramParameter4fNV(GL_VERTEX_PROGRAM_NV, 9x, p[0], p[1], p[2], p[3]);

And in the VP I have the following (R6 is eye coordinate):

"DP4 R1.x,R6,c[90];" //S
"DP4 R1.y,R6,c[92];" //T
"DP4 R1.z,R6,c[93];" //R
"DP4 R1.w,R6,c[91];" //Q
"MOV o[TEX3],R1;" //copy to texture layer 3

This is not working. Rest of VP works just not the shadow. Any ideas what I am doing wrong?

James

JWeaver
06-25-2002, 06:14 AM
I needed to invert the transposed modelview matrix.

James

knackered
06-25-2002, 06:55 AM
Originally posted by JWeaver:
(cMatrix is modelview matrix inverted):
p = p * cMatrix;

One good reason for posting the exact setup code when asking a question.