Graphics Reference
In-Depth Information
and that the primitive attributes are accessible via GUI elements. For example, we
can separately enable and disable the shading of the line and the circle. This tuto-
rial is implemented based on UWBGL _ D3D _ Lib5 and a corresponding new CModel
class.
UWBGL_D3D_Lib5
Figure 7.8.
Tutorial 7.2.
As in all previous UWBGL _ D3D libraries, source code of this library is stored in
three folders:
Folder Subfolder Purpose
Header Files - D3D specific .h files
D3D Files - D3D specific classes
Graphics API-independent source code files:
Utilities general utilities (e.g., Clock, Color)
Common Files DrawHelper DrawHeler implementation files
WindowHandler WindowHandler implementation files
Primitives Primitive hierarchy implementation files
When compared to UWBGL _ D3D _ Lib4 , the only difference is that the Primitives
subfolder has replaced the Geoms subfolder in the Common Files folder. There
are four classes in the Primitive subfolder:
Class Source Files
UWB _ Primitive uwbgl _ Primitive1.h/.cpp
UWB _ PrimitivePoint uwbgl _ PrimitivePoint1.h/.cpp
UWB _ PrimitiveLine uwbgl _ PrimitiveLine1.h/.cpp
UWB _ PrimitiveCircle uwbgl _ PrimitiveCircle1.h/.cpp
The Primitive class defines the pure virtual behavior for all primitives, and the
other three classes implement the actual functionality.
Change summary. See p. 515
for a summary of changes to
the library.
The Primitive class. Listing 7.9 shows the Primitive class implementation
and definitions. We see the following.
A: The Draw() function. Notice that this is not a virtual function. As
shown in the implementation A1, the procedure for drawing for any prim-
itive is the same: set the attributes ( SetDrawAttributes() ) and draw the
primitive ( DrawPrimitive() ). Notice that DrawPrimitive() is a pure
virtual function. In this way, the Primitive base class defines the draw-
ing procedure but does not implement the actual functions. Subclasses must
implement the DrawPrimitive() function to complete the implementation
of the Draw() function.
 
Search WWH ::




Custom Search