Archived

This topic is now archived and is closed to further replies.

jerry2

why clear to the identity matrix

Recommended Posts

jerry2    122
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.

Share this post


Link to post
Share on other sites
Dean Harding    546
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.

Share this post


Link to post
Share on other sites
jerry2    122
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.

Share this post


Link to post
Share on other sites
mittens    1323
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

Share this post


Link to post
Share on other sites
Dean Harding    546
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.

Share this post


Link to post
Share on other sites
jerry2    122
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.

Share this post


Link to post
Share on other sites