Hand write a mesh

Started by
4 comments, last by simotix 16 years, 1 month ago
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?
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.
Hi. try this
http://www.toymaker.info/html/links.html
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

<hr align="left" width="25%" />
Jack Hoxley <small>[</small><small> Forum FAQ | Revised FAQ | MVP Profile | Developer Journal ]</small>

Or you could use CreateVertexBuffer and CreateIndexBuffer on their own if you don't want to create a D3DXMesh.
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?

This topic is closed to new replies.

Advertisement