   Basic question about vertex/index buffering
  Hi I'm new to D3D and was trying to do something really simple, basically to draw a polygon in one location using D3DPT_LINESTRIP and in another location to draw a D3DPT_TRIANGLEFAN (I know triangle fans are gone in d3d 10 and I shouldn't use them but this was really just to do something with vertex and index buffers).  I created a vertex buffer and put all the vertices together into this global buffer.  Then I created an index buffer and put all the indices together in this index buffer.  I then tried to issue two successive calls to DrawIndexedPrimitive.  When I do this, the first item (the one whose indices occur in the first portion of the index buffer) gets drawn fine, and the second one is messed up.  But if I just comment out all the code to draw the first polygon, and shift all the indices down to 0-based then I can draw the second one fine too.  I just can never draw both.  I always get an error telling me there are not enough indices in the stream when I try to do all indices from the same index buffer (I've checked and rechecked the arguments to the DrawIndexedPrimitive to make sure they start from the right offsets in the buffers).I know you can use vertices for multiple objects in the same vertex buffer, is the same true for indices?  I know I'm not doing something fundamentally wrong because of the fact that just removing the first object's indices/vertices from the buffers allows me to draw the object fine.   
  Its perfectly valid to have diffrent objects in the same buffer. My guess is your calling the draw primitive method wrong, any chance of showing us the code for creating the buffers and drawing them?   ;  Was going to post the code next, but I figured I'd take one last look at the code and the direct3d docs first since it's always better to solve something yourself.I was setting up my index buffer wrong, I was accidentally skipping one of the vertices in the index buffer, and everything else was being bumped up by 1.  So actually one of the indices in the vertex buffer referred to a non-existant vertex.  I'm actually a little surprised I never got a debug break telling me this, it just worked and drew an image that looked wrong.  I had vertex/index buffers that looked like the following:VB and IB were [poly1 (linelist), poly2 (trianglefan)], separated by the --- below.-VB-....-IB-v0.......0v1.......1v2.......2v3.......3v4.......4v5.......5---......0v6......---v7.......7v8.......8v9.......9v10.....10v11.....11v12.....12v13.....13v14.....14.........15..........8When everything after the --- in the IB should have started from 6 (so 6, 7, 8, ..., 14, 7).  But 15 doesn't even refer to a valid index, yet it never crashed telling me this even though I passed 9 for the NumVertices parameter.   