I would guess that you are probably doing something wrong with arrays and overflowing one somewhere. Perhaps your number of primitives, number of vertices, or even indices is represented by 1 to NumberOfVertices rather than 0 to (NumberOfVertices-1), remember arrays work such that the first element is given the index 0, not 1. This would explain why you only have one artifact in your terrain, you skip the first element zero and add an extra element on the end. You may find you have to do something like:
g_pDevice->DrawIndexedPrimitive(D3DPT_TRIANGLELIST, 0, m_NumVerts/2, 0, m_NumPolys/2);
g_pDevice->DrawIndexedPrimitive(D3DPT_TRIANGLELIST, m_NumVerts/2 , m_NumVerts/2, (m_NumIndices/2)-1, m_NumPolys/2 );
that is if your problem is referring to an index value that does not exist. Adjust accordingly depending where you are overflowing.
I''m guessing you are referring to a non existant index value because the first call to DrawIndexedPrimitive works fine.. and there you specify 0 for the starting index. In the second call you specify starting index by reference to a variable and that is where your error comes in.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement