Graphics Reference
In-Depth Information
int CGrfxWindowD3D:: OnPaint() {
.
Source file.
GrfxWindowD3D.cpp file in
the GrfxWindow folder of the
D3D _ Rectangles3D project.
if (m _ pD3DDevice && width > 0 && height > 0)
{
//perform all of our drawing
m _ pD3DDevice->BeginScene();
.
m _ pD3DDevice->SetRenderState(D3DRS _ ZENABLE, D3DZB _ TRUE);
m _ pD3DDevice->SetRenderState(D3DRS _ CULLMODE, D3DCULL _ NONE);
m _ pD3DDevice->SetRenderState(D3DRS _ LIGHTING, FALSE);
.
Listing 13.4. Enable the Z-buffer.
int CGrfxWindowD3D:: OnPaint() {
.
Source file.
GrfxWindowD3D.cpp file in
the GrfxWindow folder of the
D3D _ Rectangles3D project.
Step 3: clear drawing buffer and draw two squares.
m _ pD3DDevice->Clear(
0, // 0 means clear the entire drawing area
NULL, // NULL means the entire drawing area
D3DCLEAR _ TARGET| // clear target (color)
D3DCLEAR _ ZBUFFER, // Clear the z-Buffer
background,
// background color to clear to
1.0f,
// Z values to clear to
.
Listing 13.5. Clear the Z-buffer.
Search WWH ::




Custom Search