Partilhar via


VertexBufferContent.Write Method (Int32, Int32, Type, IEnumerable)

Note

This method is available only when developing for Windows.

Writes additional data into the vertex buffer. Writing begins at the specified byte offset, and each value is spaced according to the specified stride value (in bytes).

Syntax

'Declaration
Public Sub Write ( _
         offset As Integer, _
         stride As Integer, _
         dataType As Type, _
         data As IEnumerable _
)
public void Write (
         int offset,
         int stride,
         Type dataType,
         IEnumerable data
)
public:
void Write(
         int offset,
         int stride,
         Type dataType,
         IEnumerable data
)

Parameters

  • offset
    Type: Int32
    Offset at which to begin writing.
  • stride
    Type: Int32
    Stride of the data being written (in bytes).
  • dataType
    Type: Type
    The type of data to be written.
  • data
    Type: IEnumerable
    The data to write.

Remarks

This method automatically grows the vertex buffer if an attempt is made to write past the buffer end. Write throws NotSupportedException if the specified data type cannot be packed into a vertex buffer. For example, if data is not a valid value type.

Use this method to interleave vertex data channels into a single buffer. This can be done by passing the total vertex size as the stride and suitable smaller offsets for each channel. You can also concatenate entire vertex buffers by passing the length of the vertex as the offset, 1 as the stride, and the vertex data as the data parameter.

Requirements

Namespace: Microsoft.Xna.Framework.Content.Pipeline.Processors

Assembly: Microsoft.Xna.Framework.Content.Pipeline (in microsoft.xna.framework.content.pipeline.dll)

See Also

Reference

VertexBufferContent Class
VertexBufferContent Members
Microsoft.Xna.Framework.Content.Pipeline.Processors Namespace

Platforms

Windows 7, Windows Vista, Windows XP