Skip to main content
GameDev.net gamedev.net
🔒 Locked

D3DVERTEXELEMENT9

Started by The C modest god Oct 10, 2003 at 9:28 AM 1 replies 350+ views
Original Post
The C modest god
The C modest god
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.
It's all about the wheel.Never blindly trust technoligy.I love my internal organs.Real men don't shower. Quote: Original post by Toolmaker Quote:
neneboricua19
neneboricua19
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
The C modest god
The C modest god
Thanks for the help
It's all about the wheel.Never blindly trust technoligy.I love my internal organs.Real men don't shower. Quote: Original post by Toolmaker Quote:

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.