Sign in to follow this  

LPD3DXMESH DrawSubset draw problem

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

Hi. I'm trying to draw a LPD3DXMESH with DrawSubset but it doesn't draw anything. this is my code. #define D3DFVF_ERISTEXTVERTEX (D3DFVF_XYZ|D3DFVF_DIFFUSE|D3DFVF_TEX1) struct ErisTextureVertex { D3DXVECTOR3 position; // The 3D position for the vertex. D3DCOLOR color; // The color. FLOAT tu, tv; // The texture coordinates. }; ErisTextureVertex face[] = { {D3DXVECTOR3(-4.0f,6.0f, 0.0f),0xFFFFFF,0,0}, {D3DXVECTOR3(-4.0f,-6.0f, 0.0f),0xFFFFFF,0,1}, {D3DXVECTOR3(4.0f,-6.0f, 0.0f),0xFFFFFF,1,1}, {D3DXVECTOR3(-4.0f,6.0f, 0.0f),0xFFFFFF,0,0}, {D3DXVECTOR3(4.0f,-6.0f, 0.0f),0xFFFFFF,1,1}, {D3DXVECTOR3(4.0f,6.0f, 0.0f),0xFFFFFF,1,0}, }; LPD3DXMESH mesht; .... D3DXCreateMeshFVF(2,6,0,D3DFVF_ERISTEXTVERTEX,g_pd3dDevice,&mesht); LPVOID pData; mesht->LockVertexBuffer(0,&pData); memcpy(pData,face,sizeof(ErisTextureVertex)*6); mesht->UnlockVertexBuffer(); DWORD *att = 0; mesht->LockAttributeBuffer(0,&att); memset(att, 0, sizeof(DWORD)*2); mesht->UnlockAttributeBuffer(); ........ then when i want to render i use: mesht->DrawSubset(0); it returns S_OK; so its fine, but it doesn't draw anything =/ then using the vertexbuffer inside the mesh with DrawPrimitive: LPDIRECT3DVERTEXBUFFER9 buffer; mesht->GetVertexBuffer(&buffer); g_pd3dDevice->SetStreamSource( 0, buffer, 0,sizeof(ErisTextureVertex)); g_pd3dDevice->SetFVF(D3DFVF_ERISTEXTVERTEX); g_pd3dDevice->DrawPrimitive(D3DPT_TRIANGLELIST,0,2); it draw my model meaning that the vertex info is in the mesh, then why drawsubset doesnt draw anything. i'm missing something like an extra definition of my mesh or something? =/ i really don't know why mesht->DrawSubset(0); do nothing >.< thnxs.

Share this post


Link to post
Share on other sites
best guess is damaged or incorect attribute buffer
try getting your attribute table[getatrbiutetable(table,size) from mesh and see how it looks
aside from that id3dxmesh needes index buffer[and u don't provide one]

Share this post


Link to post
Share on other sites

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