Archived

This topic is now archived and is closed to further replies.

drawing a mesh from a VB

This topic is 5649 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 am writing a bit of code to draw an x file mesh from a VB/IB but it doesnt seem to want to work properly. The code for drawing is
  
	Device->SetStreamSource(0,M->VB,sizeof(MeshFVF));
	Device->SetIndices(M->IB,0);
	Device->SetVertexShader(MESH_FVF);
	for (DWORD i=0;i<M->NumAttrib;i++)
	{
		Device->SetTexture(0,M->Textures[i]);
		Device->SetMaterial(&M->Material[i]);
		Device->DrawIndexedPrimitive(D3DPT_TRIANGLELIST,M->AB[i].VertexStart,
			M->AB[i].VertexCount,0,M->AB[i].FaceCount);
	}
  
Where AB is an attribute table, VB is the Vertex buffer, IB is an Index buffer and M is my Mesh class. I get the AB by doing this //Get number of attributes, create a dynamic array for them and get it
  
	FinalMesh->GetAttributeTable(NULL,&M->NumAttrib);
	M->AB=new D3DXATTRIBUTERANGE[M->NumAttrib];
	FinalMesh->GetAttributeTable(M->AB,&M->NumAttrib);
  
I create the AB by using OptimizeInPlace. Anyone loaded in a mesh and drawn it this way? Any ideas? My mesh seems to referencing from the 0 index but I cant be sure and D3D debug is showin nothing as the ranges are valid. Cheers Neil WHATCHA GONNA DO WHEN THE LARGEST ARMS IN THE WORLD RUN WILD ON YOU?!?!

Share this post


Link to post
Share on other sites