Jump to content
  • Advertisement
Sign in to follow this  

Problem: Rendering D3DXMesh with out DrawSubset()

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

Hi I'm trying to render a D3DX Mesh without using the DrawSubset method as follows:
//Rendering the model
set mesh vertex buffer as the stream source...
set mesh fvf..
set mesh index buffer...

//The code that matters.
AttributeRange[] ar = mesh.GetAttributeTable();

for (int i = 0; i < mesh.NumberAttributes; ++i)
	ar.VertexStart,	//BaseVertex
	0,			//minVertexIndex
	ar.VertexCount,	//numVertices
	ar.FaceStart,	//StartIndex
	ar.FaceCount);	//PrimCount
Now the problem is that only the first item of the AttributeTable gets rendered the right way, but the other items don't meanig if the x file loaded model contained only one submesh the results looks great but if more than one submesh used the problems showup what i think is that i didn't understand the meaning of the members of the AttributeTable so any one could explain to me what should i do??!! THX EDIT: These forums use 'code' tags for small fragments and 'source' tags for longer pieces of code.

Share this post

Link to post
Share on other sites
Presuming that MDX hasn't changed the order of parameters the following code should be useful. It's my C++ version of exactly the same thing and I know it works [smile]:

0, //BaseVertexIndex
pAttr.VertexStart, //MinIndex
pAttr.VertexCount, //NumVertices
pAttr.FaceStart * 3, //StartIndex
pAttr.FaceCount //NumPrimitives

What you got is fairly close though.


Share this post

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

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!