Graphics Reference
In-Depth Information
In addition, with respect to hands-on programming, we should:
• understand the Primitive hierarchy;
• be able to implement interactive graphics applications based on the Primi
tive hierarchy.
Listing 4.1 in Chapter 4 shows that after proper initializations, drawing with
graphics APIs involves the following.
C1. Setting of the render state.
C2. Issuing of the drawing commands.
We have already worked with drawings where we issued drawing commands to
draw triangle primitives. In addition, we have seen that an example attribute of the
triangle primitive is its color. In this chapter, we explore the different primitives
that can be drawn with graphics APIs and their corresponding attributes.
To support programming, in the tutorials we will design abstractions for the
graphics API primitives and introduce simple but commonly encountered behav-
iors for these primitives: motion, collision, and collection.
7.1 Types of Primitives
Most modern computer graphics hardware can only process/draw points, lines,
and triangles. These are the fundamental shapes that are capable of approximating
the vast majority of graphical objects that the end users are familiar with. Graphics
hardware is optimized to process these basic shapes efficiently. Modern graphics
APIs typically define simple collection structures to support an efficient descrip-
tion of the basic shapes. For example, graphics APIs typically support the draw-
ing of a point list, where an application would specify n coordinate positions and
in one drawing command request the graphics API to draw n individual points.
When compared to issuing individual drawing commands for drawing individual
points separately, the point list command optimizes the number of graphics API
calls. This becomes an important optimization when the application program is
trying to draw a very large (e.g., 10 6 ) number of points. In this section, we briefly
describe some of the common structures used for each of the basic shapes.
It is important to note that our goal here is to present the most commonly
supported primitives and their attributes. The following discussion provides a
conceptual framework for understanding graphics APIs and is not an exhaustive
list. For example, we do not describe the OpenGL convex polygon (approximated
Search WWH ::




Custom Search