1. Starting vertex in the VB
2. Number of primitives
3. Number of texture layers
4. The texture array
5. Rendering flags (Alpha blending, Z buffer stuff, ...)
Before DrawPrimitive() is called, I sort the brushes by texture. The Flush() function only changes texture if the texture id is different from the previous one. I am using triangle fans to render as the engine is optimized for that right now.
The original way I did it worked, but was unoptimal. I originally just filled the vertex buffer with the one brush then called DrawPrimitive(). When I switched to the new way, I get a "polygon soup". In otherwords, the level looks exploded. If I figure it out, version 1 of my driver is done. Next step would be to get the world into 1 static vertex buffer.
Old Way (one brush then flush vertex buffer):
New way (fill dynamic vertex buffer, render using saved brush data):