PDA

View Full Version : PROJECTION / MODELVIEW matrix analogy?



Andrea Rossini
07-22-2002, 09:51 PM
It seems to me that the projection matrix and the modelview are very similar.
once I tryed this:

glMatrixMode(GL_PROJECTION);
// call identity, setup perspective
gluLookAt(...);// or any other way to set the cam
glMatrixMode(GL_MODELVIEW);
// render something

then I tryed

glMatrixMode(GL_PROJECTION);
// call identity, setup perspective
glMatrixMode(GL_MODELVIEW);
gluLookAt(...);// or any other way to set the cam
// render something

and I noticed they work both.
Is there a good reason or I'm just confused?

tnx

Jambolo
07-22-2002, 10:09 PM
They are both 4x4 matrices. There is nothing special about them. First, the vertices are transformed by the modelview matrix, then they are transformed by the projection matrix.

However, it is important for features like fog that the result of applying the modelview matrix is view space.

[This message has been edited by Jambolo (edited 07-23-2002).]

Andrea Rossini
07-22-2002, 10:25 PM
mmmm... yes now I understand thanx