Jump to content
  • Advertisement
Sign in to follow this  
Calypoter

ID3DX10Mesh Problem

This topic is 3416 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 a problem with the ID3DX10Mesh. I have 2 vectors, the vertexlist and indexlist. Both are correct and given to the ID3DX10Mesh by SetVertexData and SetIndexData. But when I start the project I don't get a box but something like the image below. Why don't I see a box? What am I doing wrong? http://img193.imageshack.us/my.php?image=10207016.jpg

Share this post


Link to post
Share on other sites
Advertisement
Hi.
Have you locked and unlocked your buffers(VB).
Then you need to call the meshes CommitToDevice();
And then your done.

Share this post


Link to post
Share on other sites
Is your camera properly set up and pointing in the right direction? And what about the projection matrix...?

Did you disable lighting? (otherwise your object will be black and invisible against a black background)

And did you set culling to D3DCULL_NONE?

Did the Debug-runtimes tell you anything?

Share this post


Link to post
Share on other sites
I don't think I need to lock and unlock the buffers in DX10.

These are the things I do with the vectors:

m_Mesh->SetVertexData(0, &m_VertexList[0]);
m_Mesh->SetIndexData(&m_IndexList[0], m_IndexList.size());

m_Mesh->GenerateAdjacencyAndPointReps(0.001f);
m_Mesh->Optimize(D3DX10_MESHOPT_ATTR_SORT | D3DX10_MESHOPT_VERTEX_CACHE, 0, 0);
m_Mesh->GenerateGSAdjacency();
m_Mesh->CommitToDevice();

Debug says nothing. And my camera must be good because the plane is rendered good (see image below). I only get this problem with the ID3DX10Mesh. Is it a bug?

http://img190.imageshack.us/img190/6870/75377058.jpg

Share this post


Link to post
Share on other sites
It must be a bug. It works with the ID3D10Buffer but not with the ID3DX10Mesh. But I need the ID3DX10Mesh to get my shadow shader working. It needs the Adjacency info.

Rendered with the ID3D10Buffers:
http://img36.imageshack.us/img36/5020/44838038.jpg

Rendered with the ID3DX10Mesh:
http://img190.imageshack.us/img190/4456/77961667.jpg

Share this post


Link to post
Share on other sites
I've took a closer look at the screenshots.

As far as I can tell you are passing invalid data to your ID3DX10Mesh interface.
Maybe you can dump &m_VertexList[0] and &m_IndexList[0] to a file or something to see whether it matches with the vertexformat you use to render the box.

Maybe you can leave out the:

m_Mesh->GenerateAdjacencyAndPointReps(0.001f);
m_Mesh->Optimize(D3DX10_MESHOPT_ATTR_SORT | D3DX10_MESHOPT_VERTEX_CACHE, 0, 0);
m_Mesh->GenerateGSAdjacency();

Calls. Does it still give you the same result?

I'm no DX10 expert, so i might be wrong about things.

Share this post


Link to post
Share on other sites
m_VertexList and m_IndexList are correct. If I give them to the 2 ID3D10Buffers my render is correct.

And when I leave out those lines, my framerate goes down but no boxes to see. It doesn't work.

Share this post


Link to post
Share on other sites
At first, ID3DX10Mesh is built apon ID3D10Buffers.
If you can do it with mesh, you can do it with buffers.

Anyway, can you show us code about rendering but also the material table generation? Without it it's normal to have this kind of artifacts.

I see, beyond, you're going to draw a lot of cubes. I found a bug on ID3DX10Mesh that does not let you use Instancing on that class. You are forced to get buffers and draw with them manually. So if instancing is your aim, consider to use buffers from now.

Share this post


Link to post
Share on other sites
I found the bug. It was when I created the ID3DX10Mesh. The problem started when I added Tangent to the vertex. I changed the layout but not the number of elements in the createMesh function. Now it render correct.

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!