PDA

View Full Version : problem with matrices...

gvm
02-06-2003, 03:46 AM
Hello friends!
I have problem with matrices. for example, I'm doing this:
glPushMatrix();
glTranslatef(1,0.5,-5);
glRotatef(47, 1, 0.5, 0);
// HOW TO GET THIS MATRIX????
glPopMatrix();
the problem in that glGetFloatv(mymatrix, GL_MODELVIEW_MATRIX)
"The params parameter returns 16 values: the modelview matrix on the top of the modelview matrix stack. " (MSDN)
I need to get current matrix. I do not need the "matrix on the top of the modelvi..."!!!
How to do this?

Mazy
02-06-2003, 04:10 AM
The matrix on the top of the stack is the current matix

Banzai
02-06-2003, 04:12 AM
Originally posted by gvm:
Hello friends!
I have problem with matrices. for example, I'm doing this:
glPushMatrix();
glTranslatef(1,0.5,-5);
glRotatef(47, 1, 0.5, 0);
// HOW TO GET THIS MATRIX????
glPopMatrix();
the problem in that glGetFloatv(mymatrix, GL_MODELVIEW_MATRIX)
"The params parameter returns 16 values: the modelview matrix on the top of the modelview matrix stack. " (MSDN)
I need to get current matrix. I do not need the "matrix on the top of the modelvi..."!!!
How to do this?

Top of the modelview stack means the current
matrix. To get the matrix in your example,
use the following code:

glPushMatrix();
glTranslatef(1,0.5,-5);
glRotatef(47, 1, 0.5, 0);
glGetFloatv (mymatrix, GL_MODELVIEW_MATRIX);
// HOW TO GET THIS MATRIX????
glPopMatrix();

02-06-2003, 04:14 AM
It returns you current modelview matrix, so, multiplication of all matrixes.
You could do something like this:

glPushMatrix()