Graphics Reference
In-Depth Information
for approximating the outline of connected shapes (e.g., approximating the
outline of a circle).
A line segment has two types of attributes: per-vertex and per-drawing command
attributes.
Figure 7.2.
Gouraud
shaded line with a black
endpoint and a white end-
point.
Per-vertex attributes.
These are attributes that can be different for each vertex.
Examples of per-vertex attributes include the following.
•
Color.
This defines the color for the vertex. When the endpoints of a line
have different colors, the graphics hardware can perform
Gouraud shad-
ing
and linearly interpolate the color while drawing the line segment. For
Gouraud shading.
Linear
color interpolation between
endpoints with different color
values.
example, a line segment can be set to have a white endpoint and a black
endpoint. When Gouraud shading is enabled, the graphics hardware will
draw a line where the color of the line changes gradually from white to
black along the line. Figure 7.2 shows such a line.
•
Texture coordinate.
Similar to a point's texture coordinate attribute, when
texture mapping is enabled, this attribute allows us to control the color
along the line. Once again, we will study texture mapping in Chapter 12.
•
Normal vector.
This
attribute supports illumination computation for the
Illumination computation.
Compute the color of an
object based on its
material
properties
line, that is, how a light source illuminates the line. We will describe illu-
mination models and computation in Appendix A.
and
geometric
relationship
with
light
sources.
Per-drawing command attributes.
These are attributes that are associated with
each drawing command. For example, the following attributes will be applied to
all the line segments in a polyline drawing command.
•
Line color.
When Gouraud shading, illumination computation, and texture
mapping are all disabled, this color defines the color of the entire line (or
Flat shading.
Filling the inte-
rior of a geometric shape (e.g.,
line or triangle) with the same
color.
line segments for a polyline).
•
Material property.
When illumination computation is enabled, this at-
tribute defines how the line segments will be illuminated by light sources.
Once again, we will learn about illumination models and illumination com-
putation in Appendix A.
•
Line style/width.
These define the style (e.g., dotted versus solid line) and
width of a line.
Search WWH ::
Custom Search