View Full Version : Matrix Multiplication

11-27-2002, 11:07 PM
hi, just wanna ask this. We all know that using gluperspective or glulookat generates matrices. These matrices are used to transform the points. Does anyone know when the multiplication is done? I mean the exact point.

11-28-2002, 01:32 AM
the modelview matrix is multiplied as soon as you do the gluperspective or glulookat.

// modelview is identity

// modelview is the camera matrix

// model view is camera matrix * translate matrix


the resulting point will be :

P = cam_matrix * translate * point_coordinates

you should read this paper : http://www.opengl.org/developers/code/mjktips/TimHall_Reflections.txt

at the beginning it explains all this very well, even if after it goes on explaining reflections.
good luck http://www.opengl.org/discussion_boards/ubb/wink.gif

11-28-2002, 05:30 PM
gluPerspective and gluLookAt don't just generate a matrix, they multiply that matrix with the current matrix. The multiplication is immediate, but it is a little more complicated than that.

There are two matrices -- model-view and projection. Generally, you use gluPerspective with the projection matrix and gluLookAt with the model-view matrix.

When you call glVertex, the position is multiplied by both matrices to get the location on the screen.

11-28-2002, 06:53 PM
U guys are superb. Thx a million. appreciate it.