   DrawIndexedPrimitiveUP  problems
  I am having some problems getting DrawIndexedPrimitiveUP to work with triangle strips. Please note, that I am a OpenGL guy, so please dont hesitate to let me know I am WAY off. In the code below, vertexCount = number of unique verticies listed in the mesh. (but not always unique, can have duplicates, due to an unoptimized mesh loader). (*strips).m_Indices is an stl vector of unsigned int index values associated w/ vertices. vertices is of type S3DVertex, which is simply an X,Y,Z, NX, NY, NZ, U, V, etc etc.When I want to draw an indexed array of triangles I do this (this works). NOTE: here the indices are in triagle format, meaning 3 indices per triangle.pID3DDevice->DrawIndexedPrimitiveUP(D3DPT_TRIANGLELIST, 0, vertexCount, (*strips).m_Indices.size()/3,&(*strips).m_Indices[0], D3DFMT_INDEX32, vertices, sizeof(S3DVertex));BUT, when I attempt to draw an indexed triangle strip array, I end up with a "strange" render, but no crash. It seems to render parts of the strips ok, but I end up with holes in my model, and it appears that some parts of the strips streach to the top of my model (all strips seem to streach to the same point). Note: In the below, indices are now listed in strip format, meaning the first 3 indices define a triangle, then each consecutive index defines &#111;ne more triangle each.pID3DDevice->DrawIndexedPrimitiveUP(D3DPT_TRIANGLESTRIP, 0, vertexCount,(*strips).m_Indices.size()-2, &(*strips).m_Indices[0], D3DFMT_INDEX32, vertices, sizeof(S3DVertex));Here is what I think "could" be causing the problem, but &#111;nce again I am NOT a DX programmer.1. Each strip &#111;nly uses a smart part of the vertices list, could I be using the bounding (parameter 2, parameter 3) wrong?2. Is the number of primatives (parameter 4) computed differently when using DX?3. I am simply lost w/ no hope of survival? lol.Well thanx all for ANY help you can give me. </b>   
  The problem is that the index buffer for a triangle list and the index buffer for a triangle strip are rarely the same.  It seems that your mesh loader loads triangles in the form of a triangle list.  This is fine and is the fastest way to render triangles in D3D because of optimizations done on modern graphics cards and drivers.For example, say you have a quad made of four vertices.  D3D does not have a quad primitive (like GL_QUAD), so you would need to make the quad from two triangles.  Say the vertices are like this:vert[0] = (-1,-1,0) // lower leftvert[1] = (-1, 1,0) // upper leftvert[2] = ( 1, 1,0) // upper rightvert[3] = ( 1,-1,0) // lower rightFor a triangle list, the index buffer would look like this[0,1,2,0,2,3]But for a triangle strip, the index buffer would look like this:[0,1,2,3]So the main idea is that in general, you cannot use the same index buffer to render a mesh as both a triangle list and a triangle strip.Hope this helps,neneboricua ;  Well, I am pretty sure I mentioned it, but, I am using 2 different Index Types. I actualy have a structure holding a TYPE, and an index. If the TYPE = triangles, then I use the triangle index notation, if it is TYPE = strips, then I use the strip notation.So I am using the correct index array type. To prove this, I am actualy using the EXACT same method inside of an OpenGL path, and it renders just fine. Any other ideas??? Thanx for the help sofar though, its always nice to hear back from someone. ;quote:Original post by jujubean  Well, I am pretty sure I mentioned it, but, I am using 2 different Index Types. I actualy have a structure holding a TYPE, and an index. If the TYPE = triangles, then I use the triangle index notation, if it is TYPE = strips, then I use the strip notation. [snip]My mistake.  I must have missed that part of your original post.  In that case, everything seems to be fine.  The only thing I can think of is that the order of the indices aren''t specified correctly for the triangle strip version.  You have to be carefull that you specify all triangles in clockwise order, which is the opposite of how OpenGL normally does it.As a sanity check, turn off back face culling to see if that fixes your problem.  If it does, then you know that the problem is in the way you created the index buffer.  To turn off back face culling, call SetRenderState like this before you call any of the DrawPrimitve methods:m_pd3dDevice->SetRenderState( D3DRS_CULLMODE, D3DCULL_NONE );Also, just in case the problem is indeed that the indices aren''t specified correctly, there is an MSDN DX page that explains that the vertices of even numbered triangles need to be out of order so that all triangles are drawn in clockwise orientation.http://www.msdn.microsoft.com/library/en-us/directx9_c/directx/graphics/programmingguide/gettingstarted/direct3ddevices/primitives/trianglestrips.aspneneboricua 