Jump to content
  • Advertisement
Sign in to follow this  

D3D10 - Add a buffer in ID3DXMesh10

This topic is 3988 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 already made Geometry Instancing examples throught ID3D10Buffer interfaces. Now i would like make it via ID3DX10Mesh interface. I look at all methods and functions: i found that interface supports multiple vertexbuffers (as you can see in SetVertexData) and also Instanced drawing, but i'm not able to found a way to create another vertex buffer in the interface Mesh10 in which i would store instancing data (it's just a float value), neither in creation, neither after. So, how can i make it?

Share this post

Link to post
Share on other sites

I found a way: the cloneMesh function. It, infact, gave him a new array of Input Element Desc, creates me 2 vertex buffers. The first one it's already filled, but when i try to fill the second using SetVertexData(1,buffer) it gives me error. The only way to fill it it's to lock it using GetVertexBuffer with ID3DX10MeshBuffer and copy values.

Ok, no problem, but when i try to make DrawSubsetInstanced it gives me INFO about "No second vertex buffer bound to pipeline"
Using PIX it effectively does not bound second vertex buffer, but makes a redundant bound of first vertex buffer, so i'm not able to draw instanced.
Can have you got some suggestions??

Share this post

Link to post
Share on other sites
Mabye i've found a bug in the ID3DX10Mesh interface.
It supports natively the instancing feature using DrawSubsetInstanced function, but also a lot of tries, it did not worked.

I'm using an InputLayout that has got 2 input slots and it works becouse the function GetVertexBufferCount() gives me 2 that it's ok (my intention is to make a vertex buffer for position and other informations, another one for a float value that will be used via instancing.)

So, using this simple code

float *bufdata = new float[LayerNum];
for (int i = 0; i < LayerNum; i++)
bufdata = static_cast<float>(i) / LayerNum;

ID3DX10MeshBuffer *Mbuf;
void *bdata;
SIZE_T bsize;


memcpy(bdata,bufdata,sizeof(float) * LayerNum);


delete[] bufdata;

i fill the second buffer.

The drawsubsetfunction gives me an INFO that say me that the input element 3 has got a input slot = 1 but no vertex buffer is bound at slot 1. So i opened PIX and started to make a debug, and i found this:

::IASetVertexBuffers 0,1,0xabce,0xabcde,0xabcde1
::IASetVertexBuffers 0,1,0xabce,0xabcde,0xabcde2

The second buffer REPLACE the first one, and so i remain with an unbound buffer at input slot 1. Should not it be

::IASetVertexBuffers 0,1,0xabce,0xabcde,0xabcde1
::IASetVertexBuffers 1,1,0xabce,0xabcde,0xabcde2


::IASetVertexBuffers 0,2,0xabce,0xabcde,0xabcdeBUFFERARRAY?

Thank you for your attention. I'm always ready to give you code or simply more informations.

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.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!