共用方式為


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)

Syntax

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.

Exceptions

Exception type Condition
ObjectDisposedException DepthStencilBuffer was called after the GraphicsDevice was disposed.

Remarks

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.

See Also

Reference

GraphicsDevice Class
GraphicsDevice Members
Microsoft.Xna.Framework.Graphics Namespace

Platforms

Xbox 360, Windows XP SP2, Windows Vista