Graphics Reference
In-Depth Information
vertex shader main function. In line 15, we read the vertex attribute input
a_color and write it as the vertex output color v_color . In line 16, the
transformed vertex position is output by writing it to gl_Position .
Primitive Assembly
After the vertex shader, the next stage in the OpenGL ES 3.0 graphics
pipeline is primitive assembly. A primitive is a geometric object such
as a triangle, line, or point sprite. Each vertex of a primitive is sent to
a different copy of the vertex shader. During primitive assembly, these
vertices are grouped back into the primitive.
For each primitive, it must be determined whether the primitive lies
within the view frustum (the region of 3D space that is visible on the
screen). If the primitive is not completely inside the view frustum,
it might need to be clipped to the view frustum. If the primitive is
completely outside this region, it is discarded. After clipping, the vertex
position is converted to screen coordinates. A culling operation can also
be performed that discards primitives based on whether they face forward
or backward. After clipping and culling, the primitive is ready to be passed
to the next stage of the pipeline—the rasterization stage.
Rasterization
The next stage, shown in Figure 1-3, is the rasterization phase, where the
appropriate primitive (point sprite, line, or triangle) is drawn. Rasterization
is the process that converts primitives into a set of two-dimensional
fragments, which are then processed by the fragment shader. These two-
dimensional fragments represent pixels that can be drawn on the screen.
Point Sprite
Rasterization
From
Primitive
Assembly
Line
Rasterization
Output for each fragment—
screen (x w , y w ) coordinate,
attributes such as color,
texture coordinates, etc.
Triangle
Rasterization
To Fragment Shader Stage
Figure 1-3
OpenGL ES 3.0 Rasterization Stage
 
 
 
Search WWH ::




Custom Search