PDA

View Full Version : glLoadIdentity



Suf
07-21-2002, 03:55 PM
Can anyone tell me please why do we use glLoadIdentity. I am fully aware that we get identity matrix by calling the function but why do we need to call it all the time? I'd really appreciate if someone could explain this in simple English.

Suf.

hkyProgrammer88
07-21-2002, 04:29 PM
Calling glLoadIdentity is like washing a painters brush.

While rendering/painting a scene, your matrix/brush will be stained with the current transformation/color you last used.

Before rendering/painting another scene, it is wise to clear your matrix/wash your brush.

Of course you don't have to call glLoadIdentity/wash your brush, but then I think you can guess what might happen.

NOTE: You can also use glPushMatrix(), before rendering and glPopMatrix() after to avoid calling glLoadIdentity(), its like having extra brushes for each color. http://www.opengl.org/discussion_boards/ubb/smile.gif