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

Gets a copy of the vertex buffer data, specifying the start index, starting offset, number of elements, and size of the vertex buffer elements.

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

Syntax

public void GetData<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
    The array into which to copy the vertex buffer data.
  • startIndex
    Index of the element in the array at which to start copying.
  • elementCount
    Number of elements in the array.
  • vertexStride
    Size, in bytes, of an element in the vertex buffer.

Exceptions

Exception type Condition
ArgumentNullException data must be of sufficient length to receive the data.
NotSupportedException This VertexBuffer was created with a usage type of ResourceUsage.WriteOnly. Calling GetData on a resource that was created with ResourceUsage.WriteOnly is not supported.

See Also

Reference

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

Platforms

Xbox 360, Windows XP SP2, Windows Vista