Partager via


Device.Clear 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.

Overload List

public void Clear(ClearFlags, Color, float, int);
public void Clear(ClearFlags, Color, float, int, Rectangle[]);
public void Clear(ClearFlags, int, float, int);
public void Clear(ClearFlags, int, float, int, Rectangle[]);

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.

Exceptions

InvalidCallException

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