Bagikan melalui


IndexBuffer Constructor (GraphicsDevice, Int32, ResourceUsage, ResourceManagementMode, IndexElementSize)

Initializes a new instance of the IndexBuffer class.

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

Syntax

public IndexBuffer (
         GraphicsDevice graphicsDevice,
         int sizeInBytes,
         ResourceUsage usage,
         ResourceManagementMode resourceManagementMode,
         IndexElementSize elementSize
)

Parameters

  • graphicsDevice
    The GraphicsDevice object to associate with the index buffer.
  • sizeInBytes
    The size, in bytes, of the index buffer.
  • usage
    A set of options identifying the behaviors of this index buffer resource. It is good practice to match the usage parameter with the createOptions parameter in the GraphicsDevice constructor. If resourceManagementMode is ResourceManagementMode.Automatic, this value cannot be ResourceUsage.Dynamic.
  • resourceManagementMode
    The memory management mode to use for this index buffer resource. If this value is ResourceManagementMode.Automatic, the runtime will recreate the resource when the graphics device is reset. If this value is ResourceManagementMode.Manual, this resource should be reinitialized when the graphics device is reset.
  • elementSize
    The size, in bits, of an index element.

Exceptions

Exception type Condition
ArgumentNullException graphicsDevice is null.
ArgumentOutOfRangeException

One of the following conditions is true:

InvalidOperationException Unable to create this IndexBuffer resource on the graphics device.

See Also

Tasks

How to: Load Resources

Reference

GraphicsDeviceManager.DeviceReset Event
IndexBuffer Class
IndexBuffer Members
Microsoft.Xna.Framework.Graphics Namespace

Platforms

Xbox 360, Windows XP SP2, Windows Vista