VertexBuffer.SetData Generic Method (Int32, T , Int32, 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> (
         int offsetInBytes,
         T[] data,
         int startIndex,
         int elementCount,
         int vertexStride
) where T : ValueType

Type Parameters

  • T
    The type of data in the vertex buffer.

Parameters

  • offsetInBytes
    Starting offset.
  • 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.
  • vertexStride
    Size, in bytes, of an element in the vertex buffer.

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