WELL! That was a fun day-and-a-half.
I had a project that wasn’t working and I kept working on it for 15 minutes and leaving it for 8 hours, working on it and then leaving it again. It was a really frustrating problem stream 0 size is too small when I was trying to DrawIndexedPrimitives.
Well, now I got it.
DrawIndexedPrimitivesworks as follows:
graphicsDevice.DrawIndexedPrimitives( PrimitiveType.TriangleList, // the prim type to draw 0, 0, vertexCount, // THIS is the thing // that I screwed up. I kept putting INDEXCOUNT here, which is // WRONG. This is the base number of vertices you will VISIT // in this draw call. If 4 vertices are used to draw 4 triangles // (as in a tet), then this number will be 4, NOT 12. 0, indexCount / 3 // now THIS is the number of primitives that // you will end up drawing. So HERE you take into account // the number of tris you are drawing. If drawing a tet, then // this number would be 4. );
See Shawn Hargreaves hair-follicle-saving example (but its still complex, mind you) about instanced models