11-28-2002, 12:07 AM

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.

View Full Version : Matrix Multiplication

11-28-2002, 12:07 AM

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.

cbwan

11-28-2002, 02:32 AM

the modelview matrix is multiplied as soon as you do the gluperspective or glulookat.

{

glLoadIdentity();

// modelview is identity

gluLookAt(..);

// modelview is the camera matrix

glTranslate(..);

// model view is camera matrix * translate matrix

glBegin(GL_POINTS);

glVertex3f(0,0,0);

}

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

cb

{

glLoadIdentity();

// modelview is identity

gluLookAt(..);

// modelview is the camera matrix

glTranslate(..);

// model view is camera matrix * translate matrix

glBegin(GL_POINTS);

glVertex3f(0,0,0);

}

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

cb

Jambolo

11-28-2002, 06: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.

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, 07:53 PM

U guys are superb. Thx a million. appreciate it.

Powered by vBulletin® Version 4.2.3 Copyright © 2018 vBulletin Solutions, Inc. All rights reserved.