Graphics Reference
In-Depth Information
... an application sets the rendering state (C1) and then issues drawing
commands to the RC (C2). Setting of the rendering state involves
... computing/loading appropriate transformation matrices into the
matrix processors ...
We can now study these statements in detail. Figure 8.18 shows that D3D has
three matrix processors in the RC. These matrix processors are connected in a
series, where processors receive input from the output of the previous one.
These three processors are named WORLD , VIEW ,and PROJECTION . Each of
these matrix processors contains a transformation matrix: M W for WORLD , M V for
VIEW ,and M P for PROJECTION . For any given vertex V
=(
x
,
y
,
z
)
,theD3DRC
implements the transformation
VM W M V M P ,
where the vertex V will be transformed first by M W of the WORLD processor, fol-
lowed by M V of the VIEW processor, and lastly by M P of the PROJECTION pro-
cessor. One of our jobs as the graphics API programmer is to compute and load
these matrix processors.
UWBGL_D3D_Lib8
Change summary. See p. 518
for a summary of changes to
the library.
All tutorials in this chapter are developed based on version 8 of the UW _ D3D _ Lib
library. The only change in this library is the inclusion of the PrimitiveRect
angleXY class with the uwbgl _ PrimitiveRectXY1.h/cpp source files in the
Primitives subfolder of the Common Files folder. PrimitiveRectangleXY de-
fines/draws rectangles on the 2D xy -plane.
Tutorial 8.1. Translating an Object
Tutorial 8.1.
Project Name:
D3D _ TranslateSingleObj
Library Support:
UWBGL _ MFC _ Lib1
UWBGL _ D3D _ Lib8
Goals.
Experience with programming matrix processors of the graphics
APIs.
Approach. Examine the simplest case of using the matrix processor: pro-
gramming one simple translation.
Figure 8.19 is a screenshot of running Tutorial 8.1. This tutorial translates the
rectangle by the scroll-bar values in the x -and y -directions. Instead of changing
the geometric values in the PrimitiveRectangleXY object, the translation is
accomplished by programming the D3D WORLD matrix processor. The solution
Search WWH ::




Custom Search