PDA

View Full Version : (glTexGen) M*p' = p : Which modelview matrix ?



Olumide
03-14-2002, 06:38 AM
In glTexGen()if the texture generation function is GL_EYE_LINEAR, the texture generation function is:

p1'*xe + p2'*ye + p3'*ze + p4'*we

where (p1', p2', p3', p4') = (p1, p2, p3, p4)*M^-1

My question is: Which WHICH MODELVIEW MATRIX IS M? I'm thinking it's that required to transform a "vector"/the normal in the camera/eye view-plane to the object view-plane! Is this so? If not why? ...

knackered
03-14-2002, 07:09 AM
It's the MODELVIEW matrix - there is only one modelview matrix (except when using vertex programs, when you can have as many matrices as you can fit into the constants).
There's two matrices that are used to project your scene into the viewport:-
1) projection
2) modelview

There's also a texture matrix for each texture unit.

Hope this helps.

Olumide
03-19-2002, 06:29 AM
Originally posted by knackered:
[B]It's the MODELVIEW matrix - there is only one modelview matrix [B]


I find this very confusing because if q = M*p: where p = (x, y, z, w) is a point/vertex (in object space) and q = (x', y', z', w') is the eye/camera space equivalent; where M is the modelview matrix, why should the transformation of the object-space vector p = (p1, p2, p3, p4) to the eye-space form p' = (p1', p2', p3', p4') be computed the otherway round ?!? p' = M*p

HELP Pleeeeeze

Eric
03-19-2002, 06:34 AM
Have a look there:
http://ask.ii.uib.no/ebt-bin/nph-dweb/dy...html;pt=37821#X (http://ask.ii.uib.no/ebt-bin/nph-dweb/dynaweb/SGI_Developer/OpenGL_PG/@Generic__BookTextView/37493;cs=fullhtml;pt=37821#X)

The relationship between the matrix that transforms vertices and the one that transforms vectors is explained.

BTW, what you wrote is wrong (i.e. normals are not transformed by the invert of the matrix that transforms vertices). Instead:

"normal vectors are transformed by the inverse transpose of the transformation that transforms points"

Regards.

Eric

Olumide
03-19-2002, 08:18 AM
Thank You, Thank You, Thank You, Thank You, Thank You, Thank You, Thank You, Thank You, Thank You, Thank You, Thank You, Thank You, Thank You, Thank You, Thank You, Thank You, Thank You, Thank You, Thank You, Thank You, Thank You, Thank You, Thank You, Thank You, Thank You, Thank You, Thank You, Thank You, Thank You, Thank You, Thank You, Thank You, Thank You