Bagikan melalui


IndexBuffer Constructor (GraphicsDevice, Type, Int32, ResourceUsage)

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,
         Type indexType,
         int elementCount,
         ResourceUsage usage
)

Parameters

  • graphicsDevice
    The GraphicsDevice object to associate with the index buffer.
  • indexType
    The type to use for index values.
  • elementCount
    The number of values in the 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.

Exceptions

Exception type Condition
ArgumentNullException graphicsDevice is null.
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