We're a community of 1077K IT Pros here for help, advice, solutions, professional growth and fun. Join us!
1,076,379 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Start New Discussion Reply to this Discussion

Simple openGl question

So the function:

glLoadIdentity();

resets the matrix, so for instance we do this:

glMatrixMode(GL_PROJECTION);
glLoadIdentity();

how exactly does this work, it seems that we set the matrix and then just return it to the way it used to be.

2
Contributors
1
Reply
59 Minutes
Discussion Span
1 Year Ago
Last Updated
2
Views
nuclear
Junior Poster
105 posts since Aug 2011
Reputation Points: 2
Solved Threads: 3
Skill Endorsements: 0

I am not an expert, as I only recently started learning opengl myself, but from my understanding glLoadIdentity() clears the currently selected matrix. If you read through the OpenGL Documentation thoroughly, you will find that OpenGL stores four matrices of data. I learnt about them from a very helpful tutorial here. Basically the first matrix is the model matrix, it stores the offsets for the creation of stuff in your scene. The second matrix is the view matrix, it stores the offsets for the camera that views your scene. The third matrix is the modelview matrix, which is a combination of the two. The final matrix is the projection matrix, which stores information about how the camera draws the scene. Calling glLoadIdentity() resets the currently loaded matrix to an empty array (of zeroes if I remember correctly) allowing you to transform the matrices without just adding onto the previous transformations.

Labdabeta
Practically a Master Poster
615 posts since Feb 2011
Reputation Points: 27
Solved Threads: 31
Skill Endorsements: 1

This article has been dead for over three months: Start a new discussion instead

Post: Markdown Syntax: Formatting Help
 
You
View similar articles that have also been tagged:
 
© 2013 DaniWeb® LLC
Page rendered in 0.0577 seconds using 2.7MB