getting Matrix after glMatrixMult

I want to multiply two matrices and get the resulting matrix. For example for testing I tried to do this:

GLdouble mat[16];
GLdouble m[16] = 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};

``````glPushMatrix();
glMultMatrixd(m);
glPopMatrix();

glGetDoublev
``````

(GL_MODELVIEW_MATRIX,mat);

I want mat to return a matrix with zeros but it returns something different. How would I get the matrix after glMultMatrixd(m)?

Thanks,
Marc

Originally posted by mcruz:
[b]I want to multiply two matrices and get the resulting matrix. For example for testing I tried to do this:

GLdouble mat[16];
GLdouble m[16] = 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};

glPushMatrix();
glMultMatrixd(m);
glPopMatrix();

glGetDoublev
(GL_MODELVIEW_MATRIX,mat);

I want mat to return a matrix with zeros but it returns something different. How would I get the matrix after glMultMatrixd(m)?

Thanks,
Marc[/b]

I guess you donâ€™t even know how to use glPopMatrix, glPushMatrix etc.
Your code can be like this:

GLdouble mat[16];
GLdouble m[16] = 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};

glPushMatrix();
glMultMatrixd(m);
glGetDoublev(GL_MODELVIEW_MATRIX,mat);
glPopMatrix();

mat should be a zero matrix.

It is also not recommended to use GL to do your math due to performance reason.