Why does glLoadIdentity have to be called after every call to glMatrixMode?

Viewed 4610

I am reading a book on OpenGL, SDL, and have read some of the OpenGL documentation. I have also read this post: What does glLoadIdentity() do in OpenGL?

I am grasping what glLoadIdentity() does, and why it is used in a general sense (to return the current matrix back to its original state). What I do not know is why I am returning it to its original state. For instance:

glMatrixMode(GL_PROJECTION);
glLoadIdentity();

glOrtho(0.0f, 640, 480, 0.0f, -1.0f, 1.0f);

glMatrixMode(GL_MODELVIEW);
glLoadIdentity();

I am not exactly sure why glLoadIdentity() has to be called after each call to glMatrixMode.

1 Answers
Related