Graphics Reference
In-Depth Information
back-end
programming representation of the drawing area. As will be discussed,
the
UIWindow
subclasses from the MFC
CWnd
class and implements the run-time
ReplaceDialogControl()
functionality.
GHC and RC.
Recall from
Section 4.2: GHC, the
graph-
ics hardware context
,repre-
sents the hardware rendering
buffer; and RC, the
rendering
context
,
The left side of Figure 5.4 illustrates that the
GraphicsSystem
object, intro-
duced in Section 4.4 (Tutorial 4.2), will be our abstraction for interfacing with
the graphics API. From our experience working with previous tutorials, we un-
derstand that during graphics API initialization, we establish a correspondence
between the hardware buffer and the UI drawing area. This correspondence is
illustrated by the dotted line connecting the buffer in the GHC and the front-end
UI drawing area. It is this drawing area that a user can direct GUI API mouse
events to and observe graphics API drawings. The center of Figure 5.4 is the
WindowHandler
class, where it has a reference to the
UIWindow
drawing area
and behaves as a view/controller pair for our application. The
WindowHandler
has a reference to the RC and works with the
GraphicsSystem
to present the view
component drawing functionality. For the controller component functionality, the
WindowHandler
class supports the mouse events generated from the
UIWindow
.
The tutorials in this chapter derive and develop the
WindowHandler
and the
GraphicsSystem
classes. Our final ball-shooting program will be based on the
results of these classes. Our main gaols are to understand how the MVC architec-
ture can be supported and how we can achieve code re-use from our design. All
the tutorials in the rest of this topic will be based on these classes.
roughly
defines
the
appearance.
Tutorial 5.1. Interface to APIs
Tutorial 5.1.
Project Name:
D3D
_
ModelView
Library Support:
UWBGL
_
MFC
_
Lib1
UWBGL
_
D3D
_
Lib1
•
Goals.
Become familiar with the
UWBGL
libraries; more specifically, de-
velop understanding for the structure of the MFC and D3D libraries, and
for the following classes:
-
MFC
_
UIWindow
-
UWBD3D
_
WindowHandler
-
UWBD3D
_
GraphicsSystem
•
Approach.
Implement a simple interactive graphics application with
UWBGL
libraries and examine how the familiar functionality is implemented in the
different classes in the
UWBGL
.
Figure 5.5 is a screenshot of running Tutorial 5.1. Notice the familiar control
located at the lower-left corner. This is identical to the control form Tutorial 2.8
(
CCircleRadiusControls
class). In this tutorial, this control manipulates the
Figure 5.5.
Tutorial 5.1.
Search WWH ::
Custom Search