why clear to the identity matrix

Started by
4 comments, last by jerry2 22 years, 7 months ago
as the title, i want to why and when to clear the matrix to identity matrix with glIndentity(). plz tell me about the principle of it or your experience. thank u. jerry2 Programming,make a whole new world.
jerry2The God creates the world, the world creates the nature,the nature creates human. Human create...Everything.
Advertisement
Like 1 in the real numbers, anything multiplied by the identity matrix is unchanged. That is, for any matrix M, MI = M (where I is the identity matrix).

Looking at that, you would set any transformations to identity that you don''t want to affect the final vertex produced. For example, if you''re specifying your vertices in window coordinates, you''d set your view and projection matrices to identity so that they don''t change the values.

codeka.com - Just click it.
if the matrix hasn''t been transform to identity matrix,then the new matrix will be based on the matrixs operation previously.we can use the identity matrix to clear all matrixs previously and make a new matrix stack,is it right?

jerry2
Programming,make a whole new world.
jerry2The God creates the world, the world creates the nature,the nature creates human. Human create...Everything.
You set the current matrix to the identity matrix, so that you can always have things in the same place, frame-to-frame. If you never cleared the identity matrix, things would be really wierd. And using glLoadIdentity() doesn''t clear the STACK, only the current matrix, to the identity matrix.

------------------------------
Trent (ShiningKnight)
E-mail me
ShiningKnight Games
That''s true, if you''re using glRotatef() or glTranslatef(), etc, then you use glIdentity() to reset everything each frame. If you''re using glLoadMatrix() then you don''t need to, since glLoadMatrix() replaces the current matrix with the one you supply.

codeka.com - Just click it.
OK.i see.
the identity matrix make everything be origin,and then we can do anything new about matrix and don''t need to care of how many and which matrixs we have made.

thanks!




jerry2
Programming,make a whole new world.
jerry2The God creates the world, the world creates the nature,the nature creates human. Human create...Everything.

This topic is closed to new replies.

Advertisement