View more

View more

View more

### Image of the Day Submit

IOTD | Top Screenshots

### The latest, straight to your Inbox.

Subscribe to GameDev.net Direct to receive the latest updates and exclusive content.

Sign up now

# why clear to the identity matrix

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

5 replies to this topic

### #1jerry2  Members

Posted 17 September 2001 - 10:38 PM

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.

### #2Dean Harding  Members

Posted 17 September 2001 - 10:52 PM

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.

### #3jerry2  Members

Posted 18 September 2001 - 11:00 PM

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.

### #4mittens  Members

Posted 18 September 2001 - 11:19 PM

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

### #5Dean Harding  Members

Posted 18 September 2001 - 11:40 PM

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.

### #6jerry2  Members

Posted 20 September 2001 - 01:03 AM

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.

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.