Hand write a mesh
I would like to build a simple 1 x 2 x 3 rectangle build code the vertices. I was wondering if anyone knew how to or could put me in the direction on how to do this?
You can manually create a mesh using function
HRESULT D3DXCreateMesh(
DWORD NumFaces,
DWORD NumVertices,
DWORD Options,
CONST LPD3DVERTEXELEMENT9 * pDeclaration,
LPDIRECT3DDEVICE9 pD3DDevice,
LPD3DXMESH * ppMesh
);
This function creates a mesh and alocates memory. Then you just lock the vertex/index buffer and copy vertices/indices.
HRESULT D3DXCreateMesh(
DWORD NumFaces,
DWORD NumVertices,
DWORD Options,
CONST LPD3DVERTEXELEMENT9 * pDeclaration,
LPDIRECT3DDEVICE9 pD3DDevice,
LPD3DXMESH * ppMesh
);
This function creates a mesh and alocates memory. Then you just lock the vertex/index buffer and copy vertices/indices.
Quote:Original post by amigoczThe default attribute table and buffer should be fine, but you may also need to alter these if you're generating your own geometry.
This function creates a mesh and alocates memory. Then you just lock the vertex/index buffer and copy vertices/indices.
hth
Jack
Or you could use CreateVertexBuffer and CreateIndexBuffer on their own if you don't want to create a D3DXMesh.
Quote:Original post by jollyjeffersQuote:Original post by amigoczThe default attribute table and buffer should be fine, but you may also need to alter these if you're generating your own geometry.
This function creates a mesh and alocates memory. Then you just lock the vertex/index buffer and copy vertices/indices.
hth
Jack
Well if I only wanted to have a simple rectangle, how would I do that?
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement