Graphics Reference
In-Depth Information
class CTutorialDlg : public CDialog {
.
A:
virtual BOOL OnInitDialog();
// MFC function to initialize the application
private :
CDrawHandler m _ MainView;
B:
// The WindowHandler from Listing~ 15.9
CSceneTreeControl m _ TreeControl; // GUI controls for SceneNode, XformInfo, and Primitive
.
C:
BOOL CTutorialDlg::OnInitDialog() {
D:
if (!m _ MainView.Initialize( ... IDC _ GRFX _ PLACEHOLDER) ) ...
if (!UWBMFC _ ReplaceDialogControl(... IDC _ PLACEHOLDER, m _ TreeControl, ... ) ) ...
E:
m _ MainView.GetCamera()...
F:
Source file.
TutorialDlg.h/cpp
files
. // initialize camera and GUI controls
in
the
Source Files
and
Header Files folders
of
the
D3D _ CameraLib project.
Listing 15.10. The CTutorialDlg class of Tutorial 15.1.
DC-to-WC transform (label C). We will discuss the details of this func-
tion in Tutorial 15.4.
With the above WindowHandler classes support, an application would invoke the
proper functions to render a 3D scene. Listing 15.9 shows that the CDrawHandler
class of Tutorial 15.1 is a subclass of the UWBD3D _ WindowHandler class. The
most important function of this class is the DrawGraphics() function (at label A).
With the support from superclasses, that is, the camera in UWB _ WindowHandler
and the view/projection matrix compute/load functions in UWBD3D _ WindowHand
ler , it is straightforward to compute and load the matrices required for the 3D
rendering transformation pipeline (at labels C and D) and drawing of the model
(at label E).
Recall that in our MFC-based applications, we use the MFC CDialog object
as our application window and replace the D3D drawing area and GUI controls
into the CDialog object. Listing 15.10 shows that the CTutorialDlg class sub-
classes from the MFC CDialog class. Recall that in MFC dialog-based applica-
tions, the OnInitDialog() function (at label A) will be called to initialize the
application. We see that our application window has a CDrawHandler (at label B)
for D3D drawing and a CSceneTreeControl (at label C) object supporting user
interaction with UWBGL objects ( SceneNode , XformInfo ,and Primitive ).
In the implementation of the OnInitDialog() function, we first initialize the
CDrawHandler() (at label D). Recall that this function will initialize the D3D
Search WWH ::




Custom Search