• Advertisement
Sign in to follow this  

[DirectX10/Assimp] Index buffer trouble

This topic is 2906 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

I've tried to build in Assimp into my engine, but I have some trouble with the index buffer. DirectX means that the values in the Index buffer are invalid:
D3DX10: ID3DX10Mesh: Fatal error: index buffer contains invalid entries
And after looking at the Assimp viewer I just got more questions. Here is what I try to do:
	DWORD* Indices = new DWORD[MeshScene->mMeshes[NumMesh]->mNumFaces*3]; //A Vertex has 3 points, so *3
	UINT Face=0;
	for(UINT i=0;i<MeshScene->mMeshes[NumMesh]->mNumFaces;i++)
		//Fill our index buffer
		int ii=0;

	*oIndices=Indices; //Finished filling the index buffer, set the output
	*IndicesSize=MeshScene->mMeshes[NumMesh]->mNumFaces*sizeof(DWORD)*3; //Set index buffer size in bytes

I used another loader before, and I set the Indices just the way I did it here. Here is a part of my old loading function, but the parameters are still the same:
void* MeshIndexData;
DWORD* IndexData=new DWORD[mb->GetSize()/sizeof(DWORD)];





In the code of the Assimp viewer I have seen this:
g_piDevice->CreateIndexBuffer( 2 * mesh->mNumFaces * nidx, ...
while nidx is the face-style (Point=1,Line=2,Triangle=3), so for most meshes it is 3. But why the *2? Please help me! :( Edit: I found some logical errors in the code above and updated it. But it still isn't working as it should! (Same error) [Edited by - mind in a box on May 5, 2010 11:40:02 AM]

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement