Graphics Reference
In-Depth Information
with triangles) primitive type. With the discussion of triangle stripe and fan, we
expect the readers to understand the idea of approximating a convex polygon with
triangles. In addition, graphics APIs typically only support some of the following.
For example, D3D does not support line style or line width.
7.1.1
Points
Points are simple and yet can be powerful for approximating physical effects. For
example, a particle system is an approach that uses a large number of points to
approximate physical effects like fire, water, and so on. Figure 7.1 shows a simple
example of approximating fireworks with fast-moving, colorful points. Graphics
APIs typically support specifying individual points or a collection of points, that
is, point lists.
Attributes of a point include the following.
Color. This is the color that the point should be drawn.
Size. This is how large the point should be drawn.
Texture coordinate. This attribute allows each point to be displayed in
more than one color. For example, a large point may cover a few pixels,
and it is possible to display different colors for those pixels. We will learn
about texture mapping in Chapter 12.
Figure 7.1. Simple
approximation of firework
with points (Image from
Jordan Philips CSS450 Fi-
nal Project (Fall 2004)).
7.1.2
Lines
Lines are important for approximating curves, which in turn can be used to model
objects like hair, fur, and so on. To optimize the specification of lines, graphics
APIs typically support the drawing of the following.
One line segment. An application program will specify two points and
request the graphics API to draw one line.
Line segments or line lists. An application program will specify 2 n points
and request the graphics API to draw n line segments where each pair of
points define a separate line segment.
Line strips or polylines.
An application program will specify n points
(where n
1 connected line
segments. The polyline drawing command optimizes the number of vertices
an application program must specify. This drawing command is important
>
2) and request the graphics API to draw n
Search WWH ::




Custom Search