IDirect3DViewport3::Clear

The IDirect3DViewport3::Clear method clears the viewport or a set of rectangles in the viewport to the current background material.

HRESULT Clear(
  DWORD     dwCount,  
  LPD3DRECT lpRects,  
  DWORD     dwFlags   
);
 

Parameters

dwCount
Number of rectangles pointed to by lpRects.
lpRects
Address of an array of D3DRECT structures. Each rectangle uses screen coordinates that correspond to points on the render target surface. Coordinates are clipped to the bounds of the viewport rectangle.
dwFlags
Flags indicating what to clear: the rendering target, the depth-buffer, or both.
D3DCLEAR_TARGET
Clear the rendering target to the background material (if set).
D3DCLEAR_ZBUFFER
Clear the depth-buffer or set it to the current background depth field (if set).

Return Values

If the method succeeds, the return value is D3D_OK.

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

D3DERR_VIEWPORTHASNODEVICE
D3DERR_ZBUFFER_NOTPRESENT
DDERR_INVALIDOBJECT
DDERR_INVALIDPARAMS

Remarks

This method is unchanged from its implementation in the IDirect3DViewport2 interface.

The behavior of this method is undefined for depth buffers that include stencil bits, and using this method on such a depth buffer can cause the stencil bits to be arbitrarily overwritten or the depth values to be incorrect. Always use the use the IDirect3DViewport3::Clear2 method to clear depth buffers that contain stencil bits.

QuickInfo

  Windows NT/2000: Requires Windows 2000.
  Windows 95/98: Requires Windows 95 or later. Available as a redistributable for Windows 95.
  Header: Declared in d3d.h.
  Import Library: Use ddraw.lib.

See Also

IDirect3DViewport3::Clear2