Bagikan melalui


IndexBuffer Constructor (GraphicsDevice, Int32, ResourceUsage, 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,
         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.
  • 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