Graphics Reference
In-Depth Information
shader sources throughout the topic, and we hope you will not found it con-
fusing. This convention is shown in Table 2.2.
Thus at the beginning of a vertex shader (for example) we might find data
declarations such as
in vec4 aVertex;
in vec4 aTexCoord0;
uniform mat4 uModelViewProjectionMatrix;
out vec4 vST;
to pass the vertex coordinates (in model space), texture coordinates, and mod-
elviewprojection matrix into the shader and the texture coordinates from the
vertex shader to be used by the fragment shader. This kind of declaration set
will become quite familiar as you read the examples throughout the topic.
Exercises
1. Rent one of the movies mentioned in this chapter and look at the effects
we discussed. You will only see them in TV resolution, but step through
the stained glass knight or the Genesis effect ( Star Trek II: The Wrath of
Khan ) sections frame by frame and note how each works. For the stained
glass knight, notice the effect of a colored dirty surface that transmits
light from behind it.
2. Take one of the simple vertex shader source files that we use to intro-
duce the shader concepts. You will find some of the data coming from
vertex atributes, some hard-coded, and some coming from uniform vari-
ables defined through glman . For each of these data, identify an original
OpenGL function that would define the data, if possible (some of the
uniform variables do not fit this), and identify the OpenGL 2.1 built-in
variable that would contain the data.
Search WWH ::




Custom Search