DynamicIndexBuffer Constructor (GraphicsDevice, Int32, BufferUsage, IndexElementSize)

Initializes a new instance of DynamicIndexBuffer with the specified parameters.

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

Syntax

public DynamicIndexBuffer (
         GraphicsDevice graphicsDevice,
         int sizeInBytes,
         BufferUsage usage,
         IndexElementSize elementSize
)

Parameters

  • graphicsDevice
    The associated graphics device of 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.
  • 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:
  • The elementSize parameter is invalid. Index buffers can only be created for indices which are sixteen or thirty-two bits in length.
  • The sizeInBytes parameter is invalid. The resource size must be greater than zero.
  • The sizeInBytes parameter is invalid. The total size of the index buffer must be an even multiple of the index element size (either 16 or 32 bits).
InvalidOperationException This resource could not be created.

See Also

Reference

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

Platforms

Xbox 360, Windows XP SP2, Windows Vista