Graphics Reference
In-Depth Information
Vertex Shaders in the Graphics Pipeline
As we consider in detail how the
vertex shader works in the graph-
ics pipeline, we need to look at the
inputs to a shader and the outputs
from a shader, as well as the kinds
of processing that can go between
the input and the output.
In the discussions below, we
will often refer to aspects of the
GLSL shader languages that were
presented in Chapter 5, because
vertex processors deal with atri-
bute variables, uniform variables,
and variables that are passed to
other shaders for their work. If you
are working through this topic in
chapter order, this material should
be fresh, but if you are picking it up
bit by bit, you should at least skim
Chapter 5 to understand the basic
ideas of GLSL variables.
Figure 7.1. The place of vertex shaders in the pipeline.
Input to Vertex Shaders
Vertex shaders take the inputs that would ordinarily go to the vertex process-
ing stage of the graphics pipeline, along with other data that the application
might want to send to the shaders. This lets the vertex shader replace key parts
of the standard vertex processing. Vertex shaders can take atribute and uni-
form variables as inputs, and produce other variables as outputs. Both atri-
bute and uniform variables are treated as read-only variables by vertex shad-
ers. (Vertex shader out variables are treated as write-only variables destined
for the next stage in the pipeline.)
Atribute variables can take on a different value for each vertex in your
model and are considered to be read-only to the vertex shader. Some of the
atribute variables are built-in to GLSL, such as vertex coordinates, vertex
color, vertex normal, and vertex texture coordinates.
Search WWH ::




Custom Search