How to get the current state matrix


How can I get the current opengl state mechine value(the state matrix), is there any opengl function to get the current matrix? Thanks a lot!


You mean something like this?

GLdouble projMatrix[16];
GLdouble modelMatrix[16];
glGetDoublev(GL_PROJECTION, projMatrix);
glGetDoublev(GL_MODELVIEW, modelMatrix);

All the glGetXX commands will get you various values depending on what you ask them for…

See this and this


How many matrix stacks are used during opengl rendering usually, and What is the initial size of opengl state such as MODELVIEW matrix stack?



These details are all in the docs and specs.