Export (0) Print
Expand All

GraphicsDevice.DepthStencilBuffer Property

Gets or sets the depth stencil surface of this GraphicsDevice.

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

public DepthStencilBuffer DepthStencilBuffer { get; set; }

Property Value

The depth stencil buffer. If no depth stencil buffer is associated with the GraphicsDevice, the return value is null.

Setting this value to null disables the depth stencil operation.

Exception typeCondition
ObjectDisposedException DepthStencilBuffer was called after the GraphicsDevice was disposed.

The following restrictions apply when using this property.

  • The multisample type must be the same for the render target and the depth stencil surface.
  • The formats for the render target and depth stencil surface must be compatible. For more information, see CheckDepthStencilMatch.
  • The size of the depth stencil surface must be greater than or equal to the size of the render target.

These restrictions are validated only when using the debug runtime when any of the GraphicsDevice drawing methods are called.

Xbox 360, Windows XP SP2, Windows Vista

© 2014 Microsoft