Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

The C modest god

D3DVERTEXELEMENT9

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

When creating a ID3DXMESH an array of D3DVERTEXELEMENT9 is ruqired. Does that array describe the vertex data? If I have a structure of { D3DVECTOR position; D3DVECTOR normal; } How can the create mesh function tell what is the length of that array? What array I should create to describe it? I would appreaciate help on this matter. Thanks in advance.

Share this post


Link to post
Share on other sites
Advertisement
Remember, vertex declarations are used only for shaders. If you''re not using shaders, then you don''t need a vertex declaration.

struct VERTEX
{
D3DXVECTOR3 position; // vertex position

D3DXVECTOR3 normal; // vertex normal

};

// Define FVF for fixed function pipeline

const DWORD D3DFVF_VERTEX = D3DFVF_XYZ | D3DFVF_NORMAL;

// Create equivalent vertex element structure for this vertex type to be used with vertex and pixel shaders

const D3DVERTEXELEMENT9 vertexDeclaration[] =
{
{ 0, 0, D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITION, 0 },
{ 0, 12, D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_NORMAL, 0 },
D3DDECL_END()
};


Hope this helps,
neneboricua

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!