Problem with vertex/index buffers for rendering simple 2d quads - solved
I'm trying to build my own QuadBatcher class. It's supposed to work by having a dynamic vertexbuffer of size BufferSize * 4 (four vertices per quad) and a static indexbuffer of size BufferSize * 6. The buffer is locked in chunks (BatchSize) and filled, then rendered and off to more filling and so on until the buffer is full - then it's discarded and we start over gain.
My problem is that my quads are only rendered with one triangle each, unless I useCustomVertex.TransformedColoredTextured.StrideSize as starting offset in my initial Lock(). I'm sure I'm doing something wrong here. Can someone help out?
Update: I feel really stupid, I was using the wrong overload of the Device.SetStreamSource - call...I didn't specify the offset as 0 and the correct stridesize.
Before:
_device.SetStreamSource(
0,
_vertices,
CustomVertex.TransformedColoredTextured.StrideSize
);
After:
_device.SetStreamSource( 0, _vertices, CustomVertex.TransformedColoredTextured.StrideSize );
0,

