Graphics Reference
In-Depth Information
class
CGrfxWindowD3D :
public
CWnd {
.
.);
A:
bool
ReplaceDialogControl(
// Re-Places this window into the application
.
afx
_
msg void
OnPaint();
B:
// Event signifying redraw should occure
.
Source file.
GrfxWindowD3D.h
file in the
GrfxWindow
folder of the
D3D
_
Rectangles3D
project.
LPDIRECT3DDEVICE9
m
_
pD3DDevice;
// D3D Device Context
C:
};
Listing 13.1.
The
GrfxWindowD3D
class of Tutorial 13.1.
void
CGrfxWindowD3D::OnPaint() {
.
// check to ensure drawing area is defined
Step 1:
select graphics hardware render buffer.
m
_
pD3DDevice->BeginScene();
.
Source file.
GrfxWindowD3D.cpp
file in
the
GrfxWindow
folder of the
D3D
_
Rectangles3D
project.
// some details shown in Listing
13.4
Step 2:
initialize selected hardware and set the coordinate system parameters.
m
_
pD3DDevice->SetFVF(D3DFVF
_
XYZ | D3DFVF
_
DIFFUSE);
m
_
pD3DDevice->SetRenderState(D3DRS
_
CULLMODE, D3DCULL
_
NONE);
.
// matrix computation, loading of the
WORLD
,
VIEW
and
PROJECTION
matrix processors
details are in
Listing 14.4
.
Step 3:
clear drawing buffer and draw two squares.
m
_
pD3DDevice->Clear( ... );
// detailed in Listing
13.5
.
// First TRIANGLEFAN: The Large Square
v[0].m
_
point =
D3DXVECTOR3
(-4,0,4);
// Vertex
V
a
v[1].m
_
point =
D3DXVECTOR3
(4,0,4);
// Vertex
V
b
.
Listing 13.2.
The
GrfxWindowD3D::OnPaint()
function of Tutorial 13.1.
Search WWH ::
Custom Search