OpenGL: Display Process

Source: Internet
Author: User

First, let's take a look at the following flowchart:


The figure clearly shows how a 3D model is processed step by step until it is displayed on the screen.

3D objects in the world coordinate system are represented by a set of 3D coordinate values in the computer, the display process on the screen is to convert these 3D coordinates into two-dimensional screen coordinates.

Step 1: 3D geometric transformation, which is a mathematical process of Matrix Multiplication. In Graphics, we can use a matrix to "translate" the sitting value ", "zoom" (here refers to the zoom in and out of coordinate values) and "Rotate". Of course, OpenGL also applies this mathematical principle. This matrix is called "Model View matrix" in OpenGL, this is a very important concept in OpenGL. I will give a comprehensive introduction to it later.

After geometric transformation, the 3D coordinate values of all models will be changed to the 3D coordinate values under the eye coordinate system. You can understand the eye coordinate system as the OpenGL world coordinate system (I think so ), it uses the origin (0, 0, 0) as the center of the video. in OpenGL, the coordinates of the model can be defined in the coordinate system of the model itself, and OpenGL can contain multiple model systems, therefore, you must convert the model to a unified coordinate system.

 

Step 2: Projection: there are two ways of projection: Parallel projection and Perspective Projection. Here we can establish any projection method (that is to say, to create an object seeing object, you can understand the visual object as a box). It also uses a matrix to convert the sitting value. Don't be surprised. How can we use a matrix to process everything in OpenGL? In fact, this is not surprising. First, it is very convenient to use matrices to convert these coordinate values. Generally, graphics theories are described based on matrices. This conversion process is to multiply the obtained eye coordinate by a projection matrix.

 

Step 3: 3D cropping. This step is easy to understand, that is, to crop the parts not in the visible body created above. What is the visible body, I will introduce the projection in detail. Now you can understand that there is a box in OpenGL. This box is a visible body, and we can only see what is in the box, therefore, it is necessary to cut out the part outside the box to improve rendering efficiency.

Step 4: The process of transformation from a three-dimensional to a two-dimensional view. After this step, we can get the two-dimensional coordinates we want and finally display them on the screen, in fact, this step also uses a matrix. As for how this matrix looks like, we don't need to consider it. OpenGL has helped us complete this conversion. We only need to call its API, set the preview!

 

The above is the entire display process of OpenGL. This is a very basic concept. I think it is necessary to understand this process when developing OpenGL software, although it can still be written without understanding it. In fact, when you write too many OpenGL programs, you will gradually know their display process, even if you do not know at first what is going on.

If you think the above statement is incorrect, please leave your valuable comments. Thank you very much!

 

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.