i
i
i
i
i
i
i
i
18.2. Describing Geometry for the Hardware 447
data on the graphics hardware, and each has its own advantages which will be
discussed in this section. Any of the APIs you might use to program your video
card will provide different methods to load data onto the graphics hardware mem-
ory. The examples that follow are presented in pseudocode that is based loosely
on the C function syntax of OpenGL,
TM
but semantically the examples should be
applicable to other graphics APIs.
Primitives: The three
primitives (points, lines,
and polygons) are the only
primitives available! Even
when creating spline-based
surfaces, such as NURBs,
the surfaces are tessellated
into triangle primitives by
the graphics hardware.
Most graphics hardware work with specific sets of geometric primitives. The
primitive types leverage primitive complexity for processing speed on the graph-
ics hardware. Simpler primitives can be processed very fast. The caveat is that
the primitive types need to be general purpose so as to model a wide range of
geometry from very simple to very complex. On typical graphics hardware, the
primitive types are limited to one or more of the following:
• points—single vertices used to represent points or particle systems;
• lines—pairs of vertices used to represent lines, silhouettes, or edge-
highlighting;
Point Rendering: Point
and line primitives may ini-
tially appear to be lim-
ited in use, but researchers
have used points to ren-
der very complex geome-
try (Rusinkiewicz & Levoy,
2000; Dachsbacher et al.,
2003).
• polygons—triangles, triangle strips, indexed triangles, indexed triangle
strips, quadrilaterals, general convex polygons, etc., used for describing tri-
angle meshes, geometric surfaces, and other solid objects, such as spheres,
cones, cubes, or cylinders.
These three primitives form the basic building blocks for most geometry you
will define. (An example of a triangle mesh is shown in Figure 18.2.) Using these
primitives, you can build descriptions of your geometry using one of the graphics
APIs and send the geometry to the graphics hardware for rendering. For instance,
Figure 18.2. How your geometry is organized will affect the performance of your applica-
tion. This wireframe depiction of the Little Cottonwood Canyon terrain dataset shows tens of
thousands of triangles organized in a triangle mesh running at real-time rates.
The image is
rendered using the VTerrain Project terrain system courtesy of Ben Discoe.