Sign in to follow this  

LPD3DXMESH-DrawSubset()

This topic is 4582 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 have some geometry that has been split over some planes. When the geometry is untouched I can draw it just fine with the DrawSubset function. However, after I split the geometry and create my own mesh objects, when I use DrawSubset nothing appears. I am creating the meshes using the array of d3dvertexelement9 structs that is retrieved from GetDeclaration on the original mesh. Also, if I lock the vertex buffer of the created meshes and pull out the vertex data and draw it myself with DrawPrimitiveUP as triangles, it will draw correctly and I can see that I have split the geometry correctly. I'm really stumped on where the problem is.

Share this post


Link to post
Share on other sites

If you tested it against the standard errors man can make ( eg.wrong/missing light, culling, local mesh (if you dont use manged) , material, texture) it would be great to drop a few lines of the code for further help.
I remember i had a similar problem a time ago (when i worked without meshes).
If i remember well my problem was creating a mesh with a wrong size-calculation.

Share this post


Link to post
Share on other sites
Quote:
Original post by segt
Also, if I lock the vertex buffer of the created meshes and pull out the vertex data and draw it myself with DrawPrimitiveUP as triangles, it will draw correctly and I can see that I have split the geometry correctly.


Are you taking care of the index too? If your geometry works with DrawPrimitiveUP a consecutive index should work, but it still needs to be built. If you have the index under control are you using 16 or 32 bit indices? That one gets a lot of people. Are you building/using an attribute buffer?

Share this post


Link to post
Share on other sites
Well, it didn't completely solve the problem but at least now something is showing up! I'll keep working at it. Yes I am accounting for 16/32 byte index sizes. I am not building an attribute table as I would think D3DXCreateMesh would do that for me.

Edit: When I use D3DXCreateMesh, does it already allocated memory for the index buffer for me? Or do I need to intervine and create the memory before I lock it and start copying the consecutive index list in?

Share this post


Link to post
Share on other sites

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