Jump to content
  • Advertisement
Sign in to follow this  
chadmv

ID3DXMesh indexbuffer.

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

Hello, When you create an index buffer without a mesh, you need to specify the size of the buffer. However, since there is no CreateIndexBuffer function in ID3DXMesh, how does the Mesh know how much space to allocate for the indices? I know you specify the number of vertices and faces when you create the mesh, but how does it know whether you are reusing vertices via the index buffer?

Share this post


Link to post
Share on other sites
Advertisement
I do it like this:


D3DXCreateMeshFVF( m_iNumFaces, m_iNumVertices,
D3DXMESH_MANAGED | D3DXMESH_WRITEONLY | D3DXMESH_32BIT,
CUSTOMFVF,
pD3DDevice,
&m_pMesh );

DWORD *pIndices = NULL;

m_pMesh->LockIndexBuffer( 0, (void**)&pIndices );

// Loop
*pIndices++ == index;

m_pMesh->UnlockIndexBuffer();



I'm using an indexed triangle strip to create a big grid for a height map, but I don't think it renders the last row of triangles all the way.

Share this post


Link to post
Share on other sites
D3DXMesh uses triangle lists, so the index buffer has 3 entries per face.

When you create the D3DXMesh you tell it how many faces.

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!