Quantcast
Channel: Community | MonoGame - Latest topics
Viewing all articles
Browse latest Browse all 6821

Questions about offsets in GetData methods of buffers

$
0
0

@Kryten wrote:

Hi, I would like to ask a few questions about the GetData properties of the VertexBuffer and IndexBuffer to make sure I understand correctly. At first i was confused about the difference between OffsetInBytes and StartIndex. For the VertexBuffer I am thinking that the OffsetInBytes is the number of bytes into EACH vertex to find a specific element. This is because I have seen the Element.Offset used to return just the position part of the vertex data. And the StartIndex the first vertex to start reading data from. Is this correct?

VertexBuffer.GetData(OffsetInBytes, Data, StartIndex, ElementCount, VertexStride);

For the index buffer I am still confused as this has no elements, its just a list of integers. What is the difference here between OffsetInBytes and StartIndex? Is the offset the position in the return array to start writing indices to?

IndexBuffer.GetData(OffsetInBytes, Data, StartIndex, ElementCount);

I had thought that each ModelMeshPart has its own unique buffers, but then why does each part have a 'VertexOffset' and 'StartIndex'? Do ModelMeshParts share buffers?

Thanks

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 6821

Trending Articles