Graphics Reference
In-Depth Information
void CGrfxWindowD3D::OnPaint()
.
Source file.
GrfxWindowD3D.cpp file
Step 2: initialize selected hardware and set the coordinate system parameters.
.
// Initialize D3D matrix processors setting all three
// matrix processors to identity matrix
m _ pD3DDevice->SetTransform(D3DTS _ WORLD, &identity);
m _ pD3DDevice->SetTransform(D3DTS _ VIEW, &identity);
m _ pD3DDevice->SetTransform(D3DTS _ PROJECTION, &identity);
in
the GrfxWindow folder
of
D3D _ ViewTransform1
the
project.
Step 3: clear drawing buffer and draw two squares.
.
// Vertices of the LargeSquare ndc
v[0].m _ point = D3DXVECTOR3 (0.60f,0.525f,0); // V at
v[1].m _ point = D3DXVECTOR3 (-0.2f,0.525f,0); // V bt
v[2].m _ point = D3DXVECTOR3 (-0.2f,-0.475f,0); // V ct
v[3].m _ point = D3DXVECTOR3 (0.60f,-0.475f,0); // V dt
m _ pD3DDevice->DrawPrimitiveUP(D3DPT _ TRIANGLEFAN, 2, (CONST void * )v,
... );
// Vertices of the SmallSquare ndc
v[0].m _ point = D3DXVECTOR3 (0.6f,0.525f,0); // V at
v[1].m _ point = D3DXVECTOR3 (1.1f,0.525f,0); // V et
v[2].m _ point = D3DXVECTOR3 (1.1f,1.15f,0); // V ft
v[3].m _ point = D3DXVECTOR3 (0.6f,1.15f,0); // V gt
m _ pD3DDevice->DrawPrimitiveUP(D3DPT _ TRIANGLEFAN, 2, (CONST void * )v,
... );
.
Listing 10.2. CGrfxWndD3D:: OnPaint() (Tutorial 10.2)
Step 3. The two squares are specified by vertices defined by LargeSquare ndc
(Equations (10.4)) and SmallSquare ndc (Equations (10.5)).
In this tutorial, we verify our observations that we can reproduce the effects of the
M w 2 n operator of Equation (10.3). Based on the results of this tutorial, we further
observe the following.
• When all three matrix processors in the D3D RC are initialized to be the
identity matrix, only vertices between the range of
±
1
.
0 are displayed.
Search WWH ::




Custom Search