Has openGL provide matrix checking fuction?

Do anyone know how to check the matrix when using translate and rotate function?

The question is : has any openGL function call provided to check the current matrix?
Before the rotation matrix multiply by the current matrix, how do I know what the current matrix is? Because I want to check the matrix so that I can easy to correct my code. E.g.


glTranslatef(0,0, 0,0 tdist);
glRotatef(angleX, 1.0, 0.0, 0.0);
glRotatef(angleY, 0.0, 1.0, 0.0);


With glGetIntegerv(GL_MATRIX_MODE, &matrix_active) you can get the currently activated matrix. matrix_active is decalred as an integer. It will return which matrix was last activated with glMatrixMode().

How to use glGetInteger(GL_MODELVIEW_MATRIX, &active_matrix)? Because &active_matrix will return 16 values, and &active_matrix is ap pointer and not an array.

If you pass GL_MATRIX_MODE to glGetIntegerv, matrix_active will contain either GL_MODELVIEW, GL_PROJECTION or GL_TEXTURE, so one integer is sufficent.
But, if you want to obtain the actual modelview matrix (or the projection matrix), you need to declare an array of 16 floats, and call it with a different parameter.

GLfloat mvmatrix[16];
GLfloat prmatrix[16];

glGetFloatv(GL_MODELVIEW, mvmatrix);
glGetFloatv(GL_PROJECTION, prmatrix);

Now, mvmatrix will contain the current modelview matrix, and prmatrix will contain the current projection matrix.