Page 54 - Computer Graphics Handout
P. 54
predefined bitmap and stroke character sets that are defined in software and are portable.
2.4.6 Curved Objects
The primitives in our basic set have all been defined through vertices. With the exception of the point type, all consist of line
segments or use line segments to define the boundary of a region that can be filled with a solid color or a pattern.We can take two
approaches to creating a richer set of objects. First, we can use the primitives that we have to approximate curves and surfaces. For
example, if we want a circle, we can use a regular polygon of n sides. Likewise, we have approximated a sphere with triangles and
quadrilaterals. More generally, we approximate a curved surface by a mesh of convex polygons—a tessellation—which can occur
either at the rendering stage or within the user program.
The other approach, which we will explore in Chapter 10, is to start with the mathematical definitions of curved objects and then
build graphics functions to implement those objects. Objects such as quadric surfaces and parametric polynomial curves and
surfaces are well understood mathematically, and we can specify them through sets of vertices. For example, we can specify a
sphere by its center and a point on its surface, or we can specify a cubic polynomial curve using data at four points.
2.4.7 Attributes
Although we can describe a geometric object through a set of vertices, a given object can be displayed in many different ways.
Properties that describe how an object should be rendered are called attributes. Available attributes depend on the type of
object. For example, a line could be black or green. It could be solid or dashed. A polygon could be filled with a single color or with
a pattern. We could display it as filled or only by its edges. Several of these attributes are shown in Figure 2.22 for lines
and polygons.
Attributes may be associated with, or bound to, geometric objects, such as the color of a cube. Often we will find it better to model
an object such as the cube by its individual faces and to specify attributes for the faces. Hence, a cube would be green because its
six faces are green. Each face could then be described by two triangles so ultimately a green cube would be rendered as 12 green
triangles. If we go one step further, we see that each of the triangles is specified through three vertices. In a pipeline architecture,
each vertex is processed independently through a vertex shader. Hence, we can associate properties with each vertex. For example,
if we assign a different color to each vertex of a polygon, the rasterizer can interpolate these vertex colors to obtain different colors
for each fragment. These vertex attributes may also be dependent on the application. For example, in a simulation of heat
distribution of some object, the application might determine a temperature for each vertex defining the object. In Chapter 3, we
will include vertex attribute data in the array with our vertex locations that is sent to the GPU.
54

