Jump to content
  • Advertisement
Sign in to follow this  
EmptyVoid

I require assistance with D3DX10CreateMesh.

This topic is 3623 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'm trying to create a mesh but I'm a bit confused... Here is my code:

E_VERTEX *vertices = new E_VERTEX[number_of_vertices];
DWORD *indices = new DWORD[number_of_indices];
DWORD *attributes = new DWORD[number_of_indices/3];

// Then it fills the arrays with data from a file but I don't see the point in showing all that.

D3DX10CreateMesh( pd3dDevice, layout, (sizeof(layout)/sizeof(layout[0])), 0, number_of_vertices, number_of_indices, D3DX10_MESH_32_BIT, &mesh );

mesh->SetVertexData(0,vertices);
mesh->SetIndexData(indices, number_of_indices);
mesh->SetAttributeData((UINT*)attributes);

delete [] vertexdata;
delete [] facedata;
delete [] attributes;







When I call DrawSubset(0) I see nothing. What am I doing wrong? [Edited by - EmptyVoid on August 14, 2008 4:45:05 AM]

Share this post


Link to post
Share on other sites
Advertisement
That's not much code you show us. Did you setup the matrices correctly? Renderstates? Does the camera point to the mesh?

You should check for error codes:

if( FAILED( pd3dDevice->Draw.... ) )
{

}


You can check nearly every DirectX call with that and find out what is wrong.
I wrote a macro for that that throws an exception when a function fails.

V( pd3dDevice->Draw... );

Share this post


Link to post
Share on other sites
Quote:
Original post by SiS-Shadowman
That's not much code you show us. Did you setup the matrices correctly? Renderstates? Does the camera point to the mesh?

You should check for error codes:
*** Source Snippet Removed ***
You can check nearly every DirectX call with that and find out what is wrong.
I wrote a macro for that that throws an exception when a function fails.
*** Source Snippet Removed ***


Well I changed form vertex an index buffers to a mesh so I'm pretty sure all of that is set up right but I'm not sure I'm creating the mesh right. I just need someone to tell me if the code I posted is correct.

Share this post


Link to post
Share on other sites
Just a friendly note from your neighbourhood moderator - I'm all game for a bit of creativity in subject titles, but this one really goes too far "No one ever looks at the posts I need help with unless I name them creatively *sigh*". I haven't had time to browse your previous subject lines, but it could be that your non-creative subjects aren't actually descriptive enough rather than that you need whacky "out there" subjects.

More importantly, as a shared resource for the entire community I want these forums to look reasonably clean and tidy. Nothing shouts "n00b pit" like a bunch of "OMG HELPZ NEEEEEDDED!! LOLZ!!" subject lines littering the front page (yes, I know that this title isn't as bad!). Everyone is welcome but I don't want to discourage the many very talented and knowledgeable contributors from visiting this forum.

Carry on [smile]

Jack

Share this post


Link to post
Share on other sites
Quote:
Original post by EmptyVoid
Well I changed form vertex an index buffers to a mesh so I'm pretty sure all of that is set up right but I'm not sure I'm creating the mesh right. I just need someone to tell me if the code I posted is correct.


And does D3DXCreateMesh return D3D_OK?

Share this post


Link to post
Share on other sites
Quote:
Original post by jollyjeffers
Just a friendly note from your neighbourhood moderator - I'm all game for a bit of creativity in subject titles, but this one really goes too far "No one ever looks at the posts I need help with unless I name them creatively *sigh*". I haven't had time to browse your previous subject lines, but it could be that your non-creative subjects aren't actually descriptive enough rather than that you need whacky "out there" subjects.

More importantly, as a shared resource for the entire community I want these forums to look reasonably clean and tidy. Nothing shouts "n00b pit" like a bunch of "OMG HELPZ NEEEEEDDED!! LOLZ!!" subject lines littering the front page (yes, I know that this title isn't as bad!). Everyone is welcome but I don't want to discourage the many very talented and knowledgeable contributors from visiting this forum.

Carry on [smile]

Jack


I don't think talented people would care that much but I do think it would make it hard to search for by people looking for help in the future, so I'll change it.

It only had 20 views in 7 hours and 10 were mine. But after I changed the title I got 100 more in less then a hour and replies.

Share this post


Link to post
Share on other sites
Quote:
Original post by SiS-Shadowman
Quote:
Original post by EmptyVoid
Well I changed form vertex an index buffers to a mesh so I'm pretty sure all of that is set up right but I'm not sure I'm creating the mesh right. I just need someone to tell me if the code I posted is correct.


And does D3DXCreateMesh return D3D_OK?


Yes it does and I think the problem may be because I left the first value zero in SetVertexData but I don't know what I need to put there if that's the problem.

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!