Graphics Reference
In-Depth Information
In this section, we discuss the various options that an application can use
to control rasterization of triangles, strips, and fans.
Culling
Before triangles are rasterized, we need to determine whether they are
front-facing (i.e., facing the viewer) or back-facing (i.e., facing away from
the viewer). The culling operation discards triangles that face away from
the viewer. To determine whether the triangle is front-facing or back-
facing we first need to know the orientation of the triangle.
The orientation of a triangle specifies the winding order of a path that
begins at the first vertex, goes through the second and third vertex, and
ends back at the first vertex. Figure 7-10 shows two examples of triangles
with clockwise and counterclockwise winding orders.
v 1
v 1
v 0
v 2
v 0
v 2
Clockwise (CW)
Orientation
Counter-Clockwise (CCW)
Orientation
Figure 7-10
Clockwise and Counterclockwise Triangles
The orientation of a triangle is computed by calculating the signed area
of the triangle in window coordinates. We now need to translate the sign
of the computed triangle area into a clockwise (CW) or counterclockwise
(CCW) orientation. This mapping from the sign of triangle area to a CW
or CCW orientation is specified by the application using the following
API call:
void glFrontFace (GLenum dir )
dir specifies the orientation of front-facing triangles. Valid values
are GL_CW or GL_CCW . The default value is GL_CCW .
 
 
 
Search WWH ::




Custom Search