The IDirect3DViewport3::Clear2 method clears the viewport (or a set of rectangles in the viewport) to a specified RGBA color, clears the depth-buffer, and erases the stencil buffer.
HRESULT Clear2(
DWORD dwCount,
LPD3DRECT lpRects,
DWORD dwFlags,
DWORD dwColor,
D3DVALUE dvZ,
DWORD dwStencil
);
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_STENCILBUFFER_NOTPRESENT |
D3DERR_VIEWPORTHASNODEVICE |
D3DERR_ZBUFFER_NOTPRESENT |
DDERR_INVALIDOBJECT |
DDERR_INVALIDPARAMS |
This method fails if you specify the D3DCLEAR_ZBUFFER or D3DCLEAR_STENCIL flags when the render target does not have an attached depth-buffer. This behavior differs from the IDirect3DViewport3::Clear method, which will succeed if under these circumstances.
If you specify the D3DCLEAR_STENCIL flag when the depth-buffer format doesn't contain stencil buffer information, this method fails.
This method ignores the current background material for the viewport; to clear a viewport using the background material, use the IDirect3DViewport3::Clear method.
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.