The current version of OpenGL is 3.3, which is based on the renderable pipeline to achieve model generation, rendering, image output and other work.
The Render Pipeline is a series of processing of three dimensional vertices into two dimensional discrete pixels. And the user can configure freely in specific shading phases (such as vertex shading and fragment shading phases, which is the biggest difference from fixed pipeline). The brief flow of the renderable pipeline is shown below.
Second, detailed process
The figure above is basically correct, but it’s not very intuitive. How does a three-dimensional vertex transform into a pixel?I’m going to break it down into two big steps, two dimensional vertices, two dimensional vertices discretization.
1. Transformation of three-dimensional coordinates into two-dimensional coordinates
(1) Model vertex construction
Model vertices are built relative to the model’s own coordinates, namely object coordinates. Only the shape of the model can be expressed, and its position and attitude cannot be obtained, so world coordinates must be introduced.
(2) Convert to world coordinates
The world coordinates represent a larger coordinate domain, and each vertex of the model can be represented by the world coordinates. From the object coordinates to the world coordinates, you have to multiply by a world matrix, and you get the model of the relative world coordinates.
(3) World coordinate transformation camera coordinates
The world coordinate transformation of camera coordinates, from object coordinates to world coordinates, is multiplied by an observation matrix, which gives the model relative to the camera coordinates.
(4) Camera coordinate transformation screen coordinate 1
Camera coordinates transform screen coordinates. Any three – dimensional mode is displayed in two – dimensional form (screen). So a three-dimensional model is usually converted to a two-dimensional model. The first step is to build the cone with the camera as the origin.
(5) Camera coordinate transformation screen coordinate 2
Next, the 3D coordinates of the model are transformed to 2D coordinates, which are multiplied by the perspective matrix. Finally, a 2D model is projected onto the near plane of the cone.
2, 2D vertex pixelation
The vertices obtained by perspective projection are linear and cannot be displayed on the screen. They need to be pixelated, as shown in the following figure:
- The problem that the normal of the model is no longer perpendicular to the surface after unequal scaling
- Drawing a cube with OpenGL
- Matlab draw logarithmic coordinates!
- An example of 3D data modeling based on VB6 + OpenGL
- OpenGL Usage Summary (including problems encountered and solutions)
- Introduction to VTK
- Common problems and basic concept knowledge of OpenGL
- Learning from OpenGL
- Problems and solutions in learning opengl
- VTK learning notes: visual model
- Summary of OpenGL simple solar system simulation
- OpenGL basic graphics programming – OpenGL and 3D graphics world
- VTK cultivation 26: basic operation of image_ Three dimensional image slice extraction
- [learning opengl 22 step by step] – OpenGL importing 3D models with assimp Library
- Call unity with lightmap and light probes in shader
- 2016.11.1 OpenGL learning, black screen does not display graphics
- Drawing cube with OpenGL
- Building OpenGL environment
- matlab Error Subscript indices must either be real positive integers or logicals.
- Common problems of shadow map in OpenGL