• 12
• 12
• 9
• 10
• 13

# D3DFMT_INDEX32

This topic is 4790 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

In my program, I used to create my index buffer using D3DFMT_INDEX16, but I've found that for my current needs, my indices easily exceed 65536. So I changed the call to
if(FAILED(m_Graphics->GetDeviceCOM()->CreateIndexBuffer(ILIMIT*sizeof(unsigned long),
D3DUSAGE_DYNAMIC | D3DUSAGE_WRITEONLY, D3DFMT_INDEX32, D3DPOOL_DEFAULT, &p_IB,NULL))) {
MessageBox(NULL, "CreateIndexBuffer failed", "Failure", MB_OK);
return FALSE;
}


However, when I get to DrawIndexedPrimitive, I'm given the error: Direct3D9: (ERROR) :Index stream does not have required number of indices. DrawIndexedPrimitive failed. It doesn't? I didn't change anything except the size of the indices. The numbers should still be the same. Anyone have a clue as to what else might have to be changed? Cheers! [Edited by - silverRohan on February 8, 2005 7:38:01 PM]

##### Share on other sites
You are still allocating limit * sizeof(short) instead of sizeof(long). Also be aware many cards don't support 32bit indices.

##### Share on other sites
Check your MaxVertexIndex value in the capabilities struct or in the capabilities viewer utility provided by the SDK. I'm guessing most hardware currently only supports 65534 (which is what my laptop here currently says), thus 16 bit indices. 32 bit indices isn't something that you can depend on as being broadly available yet.

So it appears that for now you'll just have to redesign your rendering process so that vertices used in a single DrawIndexedPrimitive() call are never more than 65534 indices away from each other.

Quote:
 Original post by NamethatnobodyelsetookYou are still allocating limit * sizeof(short) instead of sizeof(long). Also be aware many cards don't support 32bit indices.
Silly me, I didn't even notice that.
[/edit]