Is it possible to determine the current matrix mode used by OpenGL?
For example, I currently have the following (triggered by a window resize):
glViewport(0, 0, width, height);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(-width, width, -height, height, -1.0, 1.0);
glMatrixMode(GL_MODELVIEW);
However, it's preferable to return to the previously used matrix mode, rather than assume GL_MODElVIEW
. Is there a function that could be called beforehand to store the previous state?