OpenGL rendering Pipeline
OpenGL first receives the user-provided geometry data (vertices and geometry) and enters it into a series of shader stages for processing, including vertex coloring, subdivision coloring (which itself contains two shaders), and the final geometry coloring, which is then fed into the rasterization unit (rasterizer). The Rasterization unit is responsible for Tu Yuanshong the metadata in all clipping regions (clipping region), and then executes a slice shader for each generated slice.
1 Vertex Coloring
For each vertex that draws a command transmission, OpenGL invokes a vertex shader to handle vertex-related data. Typically, a complex application may contain multiple vertex shaders, but only one vertex shader can work at a time. 2 Subdivision Coloring
Subdivision shading uses patches to describe the shape of an object and uses a relatively simple patch geometry connection to complete the work of the subdivision, with the result that the number of geometry elements increases and the appearance of the model becomes smoother. The tessellation stage uses two shaders to manage patch data separately and to produce the final shape. 3 Geometrical Coloring
Allows for further processing of each geometry before rasterization, such as creating new entities. 4 Elements Assembly
Organize the vertices and associated elements together to prepare for the next cut and rasterization work. 5 Cut
Vertices may fall outside the viewport (viewport)-that is, the area of the window where we can draw-the vertex-related entities are changed to ensure that the relevant pixels are not drawn in the viewport. This process is called clipping (clipping), which is done automatically by OpenGL. 6 rasterization
The work to be done immediately after clipping is to pass the updated entity to the Rasterization unit and generate the corresponding slice. We can treat a slice as a "candidate pixel", that is, a pixel that can be placed in the frame cache, but it can also be eventually rejected, not updating the corresponding pixel position. 7 piece of element coloring
The last stage, which can be programmed to control the display of color on the screen, is called the slice coloring phase. At this stage, we use shaders to calculate the final color of the slice (although it may also change color once during the "action-by-slice" stage) and its depth value. In this case, the color values computed in the vertex processing phase are supplemented with texture mapping, and you can discard (discard) slices that should not continue to be drawn. 8 per-slice operation
At this stage, the depth test (depth test, or z-buffering) and the template Test (stencil test) are used to determine whether a piece is visible.
If a piece succeeds in passing all active tests, it can be drawn directly into the frame cache, and its corresponding pixel color value (which may also include the depth value) is updated, and if fused (blending) mode is turned on, then the element's color is superimposed on the current color of the pixel. Creates a new color value and writes to the frame cache.