Hello guys, I have a choice to make.
I have a vertex buffer whith my data in it but not in all of it (for any reason you could imagine)
Of course I (have to) know my data's offset in this buffer, so what do I do with that offset ?
- Use it in SetStreamSource like:
pDevice->SetStreamSource(0, pTheBigBuffer, uiOffsetVertex * sizeof(MyVertex), sizeof(MyVertex));
// other calls as appropriate.
pDevice->DrawPrimitive(D3DPT_TRIANGLESTRIP, 0, 200);
- Use it in DrawPrimitive
pDevice->SetStreamSource(0, pTheBigBuffer, 0, sizeof(MyVertex));
// other calls as appropriate.
pDevice->DrawPrimitive(D3DPT_TRIANGLESTRIP, uiOffsetVertex, 200);
Assuming both would work, I wondered what would be the best choice according to you. I want to chose one way of doing this and keep consistent.
And also, assuming that this is a dynamic buffer and that other data in this buffer is completely irrelevant to me, so I won't want to batch draw calls with a unique SetStreamSource or stuff like that, I just want to draw my data.
(the purpose of all of this is that I allocate a 2Mb dynamic vertex buffer at initialisation and then I lock it at run time using D3DLOCK_NOOVERWRITE as long as there is space left in the buffer, and with D3DLOCK_DISCARD every once in a while when space runs out)
Thanks in advance for any aswers or suggestion.