Graphics Reference
In-Depth Information
With this processing for vertex coordinates, what is done for normals? In
order to compute normals accurately, OpenGL uses a Normal transformation
that maintains the normal property: if the normal vector is transformed by the
normal transformation, the result is still normal to the transformed surface.
This is implemented by the normal matrix , computed by taking the transpose
of the inverse of the upper-left 3 × 3 submatrix of the ModelView matrix. The
normal matrix is updated automatically whenever the ModelView matrix is
changed, so it does not need to be re-created each time a normal is processed.
We want to remind you that vertex lighting color computation is han-
dled in the vertex processor. This is not always obvious. If you generate colors
for your scene by using lighting and materials specification instead of simply
specifying colors for each vertex, you define a number of parameters for the
lights and for the materials of each object. This information is available to the
vertex processor, and the lighting model you specify is applied to compute a
color for each vertex. In any case, whether you use a lighting model or not, the
color of each vertex is passed into the rendering process, not calculated while
rendering.
Rendering Processing
In the rendering process, the vertex data from the vertex pipeline (pixel posi-
tion, depth, color, and texture coordinate) is used to define the set of pixels that
make up a graphical object and to calculate the color for each of these pixels.
This process associates the graphics primitive specification, the appearance
information you specify for each vertex, such as the actual texture to be used,
and directions on how appearance processing is to be done, to create the actual
image.
Primitive specifications define the way a sequence of vertices is to be used
to define a geometric object, and this quickly reduces to the question of defining
a single polygon. Polygons are defined to be planar and non-self-intersecting
(though OpenGL does not check this). Further, in
OpenGL a polygon is always assumed to be convex,
that is, to have the property that any line segment
whose endpoints are inside the polygon must itself
lie completely within the polygon. This is shown in
Figure 1.6 (although to be strict with the definition,
the rightmost figure isn't really a polygon, since it
self-intersects). If you should define a non-convex
polygon, it is usually processed in a way that is
inconsistent with your intent.
Figure 1.6. A convex (allowed) polygon (left)
and two non-convex (not allowed) polygons
(middle and right).
Search WWH ::




Custom Search