Graphics Reference
In-Depth Information
Per-batch inputs
Per-vertex inputs
Transformed
vertex
Fragment
location
Window coords
Ver tex
Clip/Cull
+
Rasterize
Clip coords
Vertex
shader
Fragment
shader
Outputs
Each can be
marked as
“smooth” if
interpolation of its
values is desired
between vertices
Inputs
From vertex
shader, post-
interpolation
Outputs
Fragment
color
Per-fragment operations
Depth test
Alpha test
Blending
Scissor test
Frame buffer
Figure 16.5: Simplified view of the fundamental components of the OpenGL programmable
pipeline.
in the empty input-related yellow boxes and in the two shader boxes. Whereas
the fixed-function pipeline can be considered a configurable appliance, the pro-
grammable pipeline is a computer on which you install an application of your
own construction. Let's first examine the pipeline's semantics in the absence of a
particular application, and then we'll look at how this pipeline might appear when
loaded with an actual program.
The application sends batches of vertices through this pipeline, each batch
representing a mesh for which certain characteristics (e.g., material or lighting)
are constant across its vertices. The vertex shader is a function that is called once
for each vertex in the batch, receiving as input the vertex and associated attributes
such as the vertex normal or the texture coordinate. The vertex shader also has
access to any number of per-batch “uniform” inputs providing information that is
constant for the entire batch (e.g., camera characteristics).
What the vertex shader does is up to the programmer. At the least, its out-
put must include the vertex transformed to clip coordinates (i.e., already passed
through modeling, viewing, and projection transformations), but it also may
include any amount of other output data values to “tag along” with this vertex
to the next stage of the pipeline. Typically, a calculated vertex color is one of the
outputs, but there is no limit to the number of outputs or their semantics. Each out-
put is typically marked as “smooth,” which tells the rasterizer stage in the pipeline
to interpolate that particular output's values for the pixels that lie between the
vertices. (The alternative is “flat,” which disables this interpolation.)
 
 
Search WWH ::




Custom Search