Platform SDK: DirectX

ID3DXContext::Clear

The ID3DXContext::Clear method clears specified surfaces from the current viewport.

HRESULT Clear(
  DWORD ClearFlags
); 

Parameters

ClearFlags
Flags indicating which surfaces should be cleared. This parameter can be any combination of the following flags, but at least one flag must be used:
D3DCLEAR_TARGET
Clear the rendering target.
D3DCLEAR_STENCIL
Clear the stencil buffer.
D3DCLEAR_ZBUFFER
Clear the depth-buffer.

Return Values

If the method succeeds, the return value is S_OK.

If the method fails, the return value may be one of the following values:

D3DERR_STENCILBUFFER_NOTPRESENT
D3DERR_VIEWPORTHASNODEVICE
D3DERR_ZBUFFER_NOTPRESENT
DDERR_INVALIDOBJECT
DDERR_INVALIDPARAMS

Remarks

This method fails if you specify the D3DCLEAR_ZBUFFER or D3DCLEAR_STENCIL flags when the render target does not have an attached depth-buffer. Similarly, if you specify the D3DCLEAR_STENCIL flag when the depth-buffer format doesn't contain stencil buffer information, this method fails.

This method clears to the current viewport. Specify the color the viewport clears to with the ID3DXContext::SetClearColor method, the value the depth buffer clear to with the ID3DXContext::SetClearDepth method, and the value the stencil buffer clears to with ID3DXContext::SetClearStencil method.

Requirements

  Windows NT/2000: Requires Windows 2000.
  Windows 95/98: Requires Windows 95 or later. Available as a redistributable for Windows 95.
  Version: Requires DirectX 7.0.
  Header: Declared in d3dxcore.h.
  Library: Use d3dx.lib.

See Also

ID3DXContext::SetClearColor, ID3DXContext::SetClearDepth, ID3DXContext::SetClearStencil