   Index buffers tutorials for 2D games?
  I have come to a major block in my engine.I am using D3D 9 with textured quads for my 2D engine.I was getting lousy framerates so I thought I would tackle index buffers.  I just can''t seem to grasp the concept and my code doesn''t work. I am sure it''s because of my ignorance of index buffers.Anyway, does anyone know where I can find a good tutorial for using index buffers on 2D games?  Like tile-based games?  Every tutorial seems to revolve around drawing cubes and such.  I need tiles!  :-)thankscb   ~ c  o l ec o ~  Rock the cradle of love!You stupid WANKER!S i g n a l D E V .comMetroid Classic
  What do you mean by tiles?  If you are using 2D textured quads, I suppose you only have 4 vertices per tile.  In this case, adding an index buffer would not improve your performance much at all.  Index buffers improve performance when you have a lot of faces that share vertices, like in a more complex mesh. ;  Well, my understanding is that the increase comes from the single DrawIndexedPrimitive.  All of my tiles use one texture and before I got into batching, I hade a drawprimitive for each tile.cb ;  While it won't increase performance drastically its still a good step to do. Also it does save on the memory enough memory that has to be passed on the bus for it be useful.EDITSince I didn't really answer your questions, and neither has anyone else I'll try to explain. Here's the easy way that I've done it a few times:If you're trying to just pass 4 vertices per quad instead of 6 you can just create a static index buffer that contains 6 word indices for every 4 vertices in your vertex buffer.After creating the index buffer just do a one time initialization of the indices with a simple loop. So you'd just loop through, 6 at a time, and set them (for instance the first six would be 0,1,2,2,1,3). Then call Optimize() on the index buffer, SetIndices() to set them as active.   [edited by - Zorbfish on February 11, 2004 12:28:24 PM]