opened
georg-eckert-zeiss
username_0
The [documentation](
https://docs.monogame.net/api/Microsoft.Xna.Framework.Graphics.VertexBuffer.html#Microsoft_Xna_Framework_Graphics_VertexBuffer_SetData__1_System_Int32___0___System_Int32_System_Int32_System_Int32_) of `VertexBuffer::SetData` is not very detailed.

There it says under "Remarks":

"If `T` is `VertexPositionTexture`, but you want to set only the position component of the vertex data, you would call this method as follows:

```cs
Vector3[] positions = new Vector3[numVertices];
vertexBuffer.SetData(0, positions, 0, numVertices, vertexBuffer.VertexDeclaration.VertexStride);
´´´

Continuing from the previous example, if you want to set only the texture coordinate component of the vertex data, you would call this method as follows (note the use of offsetInBytes:

´´´
Vector2[] texCoords = new Vector2[numVertices];
vertexBuffer.SetData(12, texCoords, 0, numVertices, vertexBuffer.VertexDeclaration.VertexStride);
´´´
"

But there is no explanation, where the various values originate from:

* 12 ... size in bytes of the position component (a `Vector3` I guess)
* to understand the example we need to know which `VertexDeclaration` is used
* this example works only, if the data is at the beginnig of the buffer
  + if there are multiple meshes in the buffer, the offset must be adjusted accordingly

What I want to say is: please provide a more detailled example with a detailled explanation : )

Cheers,
Georg
[Doc] Incomplete VertexBuffer documentation
issue