When drawing geometry,
Direct3D has the option of interpreting the points you send in multiple
ways. By connecting these points in different ways, it affects how your
geometry is drawn. For instance, you could declare a series of three
points; depending on the primitive type you select, these points could
be drawn as either three individual dots or as a line-connected
triangle.
Based on the primitive type you select, the number
of points necessary to draw your object can be greatly reduced.
Direct3D offers the following primitive types:
Point lists
Line lists
Line strips
Triangle lists
Triangle strips
Triangle fans
Point Lists
A point list consists of a series of points that are not connected in any way. Figure 1
shows a grid containing four distinct points. Each point is defined
using X, Y, and Z coordinates. For example, the top-left point would be
defined as (1, 6, 0).
Line Lists
Line lists consist of lines constructed by two points, one at each end. The lines within a line list are not connected. Figure 2
shows two lines rendered using a line list. This particular line list
is constructed from four vertices. The line on the left is formed using
(–6, 5, 0) for the upper coordinate and (–4, 2, 0) for the bottom
coordinate.
Line Strips
Line strips
are a series of connected lines where each additional line is defined
by a single vertex. Each vertex in the line strip is connected to the
previous vertex for a line. Figure 3
shows how a line list is constructed and rendered. The line list in
this figure is constructed using a series of six vertices creating five
lines.
Triangle Lists
Triangle lists contain triangles that are not connected in any way and can appear anywhere within your world. Figure 4
shows two individual triangles constructed from six vertices. Each
triangle requires three vertices to construct a complete triangle.
Triangle Strips
Triangle strips are a series of triangles connected to one another where only one vertex is required to define each additional triangle. Figure 5 shows four triangles created using only six vertices.
Triangle strips are constructed first by creating
three vertices to define the first triangle. If an additional vertex is
defined, lines are drawn between the two
previously created vertices, forming another triangle. Within Figure 5, the order in which the vertices are created is shown.
Triangle Fans
Triangle fans
are a series of triangles that share a common vertex. After the first
triangle is created, each additional vertex creates another triangle
with one of its points being the first vertex defined.
Figure 6
shows how a triangle fan consisting of three triangles is created using
only five vertices. The order of the vertices controls what the
triangle fan looks like. Figure 6 shows the order in which the vertices are created to construct the displayed fan.