1,105,546 Community Members

Simple openGl question

Member Avatar
nuclear
Junior Poster
105 posts since Aug 2011
Reputation Points: -9 [?]
Q&As Helped to Solve: 3 [?]
Skill Endorsements: 0 [?]
 
0
 

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.

Member Avatar
Labdabeta
Master Poster
769 posts since Feb 2011
Reputation Points: 161 [?]
Q&As Helped to Solve: 42 [?]
Skill Endorsements: 6 [?]
 
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.

You
This article has been dead for over three months: Start a new discussion instead
Post:
Start New Discussion
View similar articles that have also been tagged: