I require assistance with D3DX10CreateMesh.

Started by
15 comments, last by EmptyVoid 15 years, 8 months ago
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]
This is your life, and it's ending one minute at a time. - Fight club
Advertisement
Does anyone see what I'm doing wrong... Yet?
This is your life, and it's ending one minute at a time. - Fight club
Does the directX runtime print any messages to the debug output?
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... );
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.
This is your life, and it's ending one minute at a time. - Fight club
Looks like someone else is having the exact same problem as me lol
This is your life, and it's ending one minute at a time. - Fight club
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

<hr align="left" width="25%" />
Jack Hoxley <small>[</small><small> Forum FAQ | Revised FAQ | MVP Profile | Developer Journal ]</small>

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?
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.
This is your life, and it's ending one minute at a time. - Fight club
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.
This is your life, and it's ending one minute at a time. - Fight club

This topic is closed to new replies.

Advertisement