VertexBuffer.SetData Generic Method (T , Int32, Int32)

Sets the vertex buffer data.

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

Syntax

public void SetData<T> (
         T[] data,
         int startIndex,
         int elementCount
) where T : ValueType

Type Parameters

  • T
    The type of data in the vertex buffer.

Parameters

  • data
    Array from which to copy the vertex buffer data.
  • startIndex
    Index of the element in the array at which to start copying.
  • elementCount
    Number of elements to copy.

Exceptions

Exception type Condition
ArgumentNullException data is null.
ArgumentOutOfRangeException One of the following conditions is true:
  • The vertex stride is larger than the vertex buffer.
  • The vertex stride is too small for the type of data requested.
InvalidOperationException The array is not the correct size for the amount of data requested.

Remarks

An InvalidOperationException is thrown if an attempt is made to modify (for example, calls to the SetData method) a resource that is currently set on a graphics device.

See Also

Reference

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

Platforms

Xbox 360, Windows XP SP2, Windows Vista