Compartir a través de


Device.Clear Method (ClearFlags, Int32, Single, Int32)

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.

Namespace: Microsoft.WindowsMobile.DirectX.Direct3D
Assembly: Microsoft.WindowsMobile.DirectX (in microsoft.windowsmobile.directx.dll)

Syntax

'Declaration
Public Sub Clear ( _
    flags As ClearFlags, _
    color As Integer, _
    zdepth As Single, _
    stencil As Integer _
)
'Usage
Dim instance As Device
Dim flags As ClearFlags
Dim color As Integer
Dim zdepth As Single
Dim stencil As Integer

instance.Clear(flags, color, zdepth, stencil)
public void Clear (
    ClearFlags flags,
    int color,
    float zdepth,
    int stencil
)
public:
void Clear (
    ClearFlags flags, 
    int color, 
    float zdepth, 
    int stencil
)
public void Clear (
    ClearFlags flags, 
    int color, 
    float zdepth, 
    int stencil
)
public function Clear (
    flags : ClearFlags, 
    color : int, 
    zdepth : float, 
    stencil : int
)
Not applicable.

Parameters

  • flags
    The flags that indicate which surfaces to clear. This parameter can be any combination of the following flags, but at least one flag must be used:

    • Stencil: Clears the stencil buffer to the value in the stencil parameter.

    • Target: Clears the render target to the color in the color parameter.

    • ZBuffer: Clears the depth buffer to the value in the zdepth parameter.

  • color
    An integer value that represents the color to which the render target surface is cleared.
  • zdepth
    A new zdepth value that this method stores in the depth buffer. This parameter can be in the range of 0.0 through 1.0 (for z-based or w-based depth buffers). A value of 0.0 represents the nearest distance to the viewer; a value of 1.0 represents the farthest distance.
  • stencil
    An integer value to store in each stencil-buffer entry. This parameter can be in the range of 0 through 2n-1, where n is the bit depth of the stencil buffer.

Exceptions

Exception type Condition

InvalidCallException

The method call is invalid. For example, a parameter might contain an invalid value.

Remarks

This method fails if the ZBuffer or Stencil flags are specified when the render target does not have an attached depth buffer. Similarly, the method fails if the Stencil flag is specified when the depth-buffer format does not contain stencil buffer information.

Platforms

Windows CE, Windows Mobile for Pocket PC, Windows Mobile for Smartphone

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

Version Information

.NET Compact Framework

Supported in: 2.0

See Also

Reference

Device Class
Device Members
Microsoft.WindowsMobile.DirectX.Direct3D Namespace