Sign in to follow this  

D3DFMT_INDEX32

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

If you intended to correct an error in the post then please contact us.

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 this post


Link to post
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.

[edit]
Quote:
Original post by Namethatnobodyelsetook
You 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]

Share this post


Link to post
Share on other sites

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

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this