Graphics Reference
In-Depth Information
3.2
A Computer Graphics Solution
Tutorial 3.1. Drawing Squares with MFC and D3D
Tutorial 3.1.
Project Name
D3D _ Rectangles2D
Goal. Examine and learn the drawing procedures of a graphics API.
Approach. Examine the drawing procedures of a simple program that
draws the two squares form Figure 3.4.
Figure 3.5 is a screenshot of running Tutorial 3.1. This program draws the two
squares with measurements from Figure 3.4 and waits for the user to click on the
quit button. It is developed based on the D3D graphics API and the MFC GUI
API.
Front-End GUI Layout
Figure 3.6 shows that there are four GUI elements in Tutorial 3.1: the applica-
tion window, the quit button, the placeholder, and the D3D drawing area. This
diagram illustrates a scheme similar to that of Tutorial 2.8, where we will replace
the placeholder ( IDC _ GRFX _ PLACEHOLDER ) in the main window with the D3D
drawing area.
Notice that the D3D drawing area does not have a GUI ID. Because this GUI
element is dedicated for D3D drawing and this element's position is defined by
the placeholder, we did not create any representation for this element during the
Figure 3.5.
Tutorial 3.1.
GUI Element: Application Window
GUI Element: D3D Drawing Area
GUI ID: None
Control Variable: m_GrfxWnd (CTutorialDlg.h)
Contrl Variable Data Type: CGrfxWindowD3D
Replaces
IDC_GRFX_PLACEHOLDER
GUI Element: Place Holder
GUI ID: IDC_GRFX__PLACEHOLDER
GUI Element: Quit Button
Figure 3.6.
Front-end layout of Tutorial 3.1.
 
Search WWH ::




Custom Search