• Advertisement
Sign in to follow this  

Hand write a mesh

This topic is 3655 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 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?

Share this post


Link to post
Share on other sites
Advertisement
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.

Share this post


Link to post
Share on other sites
Quote:
Original post by amigocz
This function creates a mesh and alocates memory. Then you just lock the vertex/index buffer and copy vertices/indices.
The default attribute table and buffer should be fine, but you may also need to alter these if you're generating your own geometry.

hth
Jack

Share this post


Link to post
Share on other sites
Or you could use CreateVertexBuffer and CreateIndexBuffer on their own if you don't want to create a D3DXMesh.

Share this post


Link to post
Share on other sites
Quote:
Original post by jollyjeffers
Quote:
Original post by amigocz
This function creates a mesh and alocates memory. Then you just lock the vertex/index buffer and copy vertices/indices.
The default attribute table and buffer should be fine, but you may also need to alter these if you're generating your own geometry.

hth
Jack


Well if I only wanted to have a simple rectangle, how would I do that?

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement