Graphics Reference
In-Depth Information
void CGrfxWndD3D::OnPaint() {
.
C1: with the selected render buffer set the render state and matrix processors.
Step 2: initialize selected hardware and set the coordinate system parameters.
.
m _ pD3DDevice->SetRenderState(D3DRS _ CULLMODE, D3DCULL _ NONE);
Source dile.
GrfxWindowD3D.cpp file in
the GrfxWindow folders of the
D3D_Rectangles2D project.
m _ pD3DDevice->SetRenderState(D3DRS _ LIGHTING, FALSE);
.
m _ pD3DDevice->SetTransform( D3DTS _ WORLD, &identity);
m _ pD3DDevice->SetTransform( D3DTS _ VIEW, &identity);
m _ pD3DDevice->SetTransform( D3DTS _ PROJECTION, &identity);
.
// Operations to compute the coordinate system
m _ pD3DDevice->SetTransform( D3DTS _ VIEW, &world2ndc );
C2: Send drawing commands to the RC ( m_pD3DDevice ).
.
Step 3: clear drawing buffer and draw two squares.
m _ pD3DDevice->Clear( ... );
.
// Set vertex information
v[1].m _ point = D3DXVECTOR3 (160,122,0);
.
// Send the vertex information and drawing command
m _ pD3DDevice->DrawPrimitiveUP( D3DPT _ TRIANGLEFAN
... (CONST void * )v );
.
Listing 4.1. Re-examine drawing with D3D (Tutorial 3.1).
application sets the rendering state (C1) and then issues drawing commands
to the RC (C2). Setting the rendering state involves activating the proper
render buffer, setting all relevant primitive and illumination attributes, and
computing/loading appropriate transformation matrices into the matrix pro-
cessors. A drawing command is typically a series of vertex positions ac-
companied by instructions on how to interpret the vertices (e.g., two vertex
positions with an instruction that these are endpoints of a line).
Search WWH ::




Custom Search