Sign in to follow this  
simotix

Hand write a mesh

Recommended Posts

simotix    142
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
amigocz    122
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
jollyjeffers    1570
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
simotix    142
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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this