GLTools-GLFrame concept,
Learning OpenGL has been around for a few days. Recently, I have finally figured out the meaning of the role frame. Here I will simply record it and leave a message if something is wrong.
In fact, a role frame is also called an observer. Generally, a moving object is called a role. Only a role can change its own structure. Therefore, GLFrame is used for change. It can be used to generate a model view matrix. To generate location movement.
GetCameraMatrix is a GLFrame function. We usually use this function to set it. We can use this function to obtain a matrix transformed by the observer.
This function is to first generate a rotating matrix, then generate a translation matrix, and then perform cross multiplication between the two. In fact, we move the observer forward. If the object itself is in front of our observer, in fact, objects are amplified. So the above is actually why we need to reverse the Z axis. All the changes are invert. The reason why y does not need to take negative numbers, my current idea is that if my vUp gets a negative number, it means my head is looked down. Then, based on the multiplication of the matrix, the coordinates will also be reversed, this is actually enough. In other words, the coordinate system of camera is that the Z axis is in the negative direction, the x axis is in the positive direction to the left, and the Y axis is in the same direction, you can also understand it when creating a rotation matrix. My camera moves to the left, which is equivalent to turning the object to the right. That is, the vUp here is the y column of the Matrix.
For example, we can set the left arrow of the keyboard to move the object around the Y axis.
If (key = maid) viewFrame. RotateWorld (m3dDegToRad (5.0), 0.0f, 1.0f, 0.0f );
After we press the left button, the object is shown as follows, which reflects this statement.