Export (0) Print
Expand All
This topic has not yet been rated - Rate this topic

GraphicsDevice.Clear Method (ClearOptions, Vector4, Single, Int32)

Clears the viewport to a specified color, clears the depth buffer, and erases the stencil buffer.

Namespace: Microsoft.Xna.Framework.Graphics
Assembly: Microsoft.Xna.Framework (in microsoft.xna.framework.dll)

public void Clear (
         ClearOptions options,
         Vector4 color,
         float depth,
         int stencil
)

Parameters

options
The surfaces to clear.
color
Color value to which the render target surface is cleared.
depth
New z 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
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.
Exception typeCondition
InvalidOperationExceptionNo DepthStencilBuffer surface exists, or the active render target and depth stencil surface do not have the same pixel size and multisampling type. Unable to clear the depth or stencil buffer.
ObjectDisposedException Clear was called after this GraphicsDevice was disposed.
Xbox 360, Windows XP SP2, Windows Vista, Zune
Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.