Game Development Reference
In-Depth Information
2.1.2 Triangles
Triangles are the basic building blocks of 3D objects. To construct an
object, we create a triangle list that describes the shape and contours of
the object. A triangle list contains the data for each individual triangle
that we wish to draw. For example, to construct a rectangle, we break it
into two triangles, as seen in Figure 2.4, and specify the vertices of
each triangle.
Figure 2.4: A rectangle built from two
triangles
Vertex rect[6] = {v0, v1, v2, // triangle0
v0, v2, v3}; // triangle1
Note: The order in which you specify the vertices of a triangle is
important and called the winding order. See section 2.3.4 for
information.
2.1.3 Indices
Often the triangles that form a 3D object share many of the same verti-
ces, as the rectangle in Figure 2.4 illustrates. Although only two
vertices are duplicated in the rectangle example, the number of dupli-
cate vertices can increase as the detail and complexity of the model
increases. For instance, the cube in Figure 2.5 has eight unique verti-
ces, but many of them would be duplicated to form the triangle list for
the cube.
Figure 2.5: A cube defined by triangles
Search WWH ::




Custom Search