GLTools-GLFrame concept,

Source: Internet
Author: User

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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.