opengl coordinate system transformation process

Qianyan: Since I need to learn about drawing and rendering recently, I will record the basic knowledge points that I think are more representative of OpenGL from time to time, and also share the essence of Open with everyone~~

We need to use several transformation matrices, the most important ones are the three matrices of Model, View, and Projection. Our vertex coordinates start from the local space (Local Space), where it is called the local coordinate (Local Coordinate). It will later become the world coordinate (World Coordinate), the observation coordinate (View Coordinate), and the clipping coordinate (Clip Coordinate), and finally ends in the form of screen coordinate (Screen Coordinate). The picture below shows the entire process and what each transformation process does:
The changing process of the coordinate system

1Local coordinates are the coordinates of the object relative to the local origin, and are also the coordinates of the object's starting point.
2The next step is to transform the local coordinates into world space coordinates, which are in a larger spatial range. These coordinates are relative to the world's global origin, and they, along with other objects, are positioned relative to the world's origin.
3 Next, we transform the world coordinates into observation space coordinates, so that each coordinate is observed from the perspective of the camera or observer.
After the 4 coordinates arrive in the observation space, we need to project them to the clipping coordinates. The clipping coordinates are processed to a range of -1.0 to 1.0 and determine which vertices will appear on the screen.
5 Finally, we transform the clipping coordinates into screen coordinates. We will use a process called Viewport Transform. The viewport transformation transforms coordinates in the -1.0 to 1.0 range into the coordinate range defined by the glViewport function. The final transformed coordinates will be sent to the rasterizer to convert them into fragments.

Guess you like

Origin blog.csdn.net/zhaohuappc/article/details/70741769