LPD3DXMESH DrawSubset draw problem

Started by
1 comment, last by FallenV2 13 years, 11 months ago
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.
Advertisement
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]
Crazy dude smoking D3D11, AngelScript, PhysX, 3D Sound, Network, DB, FBX, and some other weird things, doing that on Visual Studio 2010 + Visual Assist X on Overclocked CPU
:O thanks, i didn't know that i needed to use an indexbuffer. i thought that the index buffer was optional.

This topic is closed to new replies.

Advertisement