Game Development Reference
In-Depth Information
return true;
}
void Cleanup()
{
}
We don't have any resources or things to set up in this sample, so the
Setup
and
Cleanup
methods are empty.
bool Display(float timeDelta)
{
if( Device )
{
Device->Clear(0, 0, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER,
0x00000000, 1.0f, 0);
Device->Present(0, 0, 0, 0);// present backbuffer
}
return true;
}
The
Display
method calls the
IDirect3DDevice9::Clear
method, which clears the back buffer and depth/stencil buffer to the
color black and 1.0, respectively. Notice that we only perform the draw-
ing code if the application is not paused. The declaration of
IDirect3DDevice9::Clear
is:
HRESULT IDirect3DDevice9::Clear(
DWORD Count,
const D3DRECT* pRects,
DWORD Flags,
D3DCOLOR Color,
float Z,
DWORD Stencil
);
Count
—Number of rectangles in the
pRects
array
pRects
—An array of screen rectangles to clear. This allows us to
only clear parts of a surface.
Flags
—Specifies which surfaces to clear. We can clear one or
more of the following surfaces:
D3DCLEAR_TARGET
—The render target surface, usually the
back buffer
D3DCLEAR_ZBUFFER
—The depth buffer
D3DCLEAR_STENCIL
—The stencil buffer
Color
—The color we wish to clear the render target to
Z
—The value we wish to set the depth buffer (z-buffer) to
Stencil
—The value we wish to set the stencil buffer to
Search WWH ::
Custom Search