problem with matrices...

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?

The matrix on the top of the stack is the current matix

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();

It returns you current modelview matrix, so, multiplication of all matrixes.
You could do something like this:

glPushMatrix()
glLoadIdentity();
// perform transforms
glGetMatrixv(…)
glPopMatrix()

and glGetFloatv should have GL_MODELVIEW_MATRIX first, then your variable (glGetfloatv(GL_MODELVIEW_MATRIX, mymatrix);

jebus