# where can i find the D3DFVF format

This topic is 1924 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

there's only float on msdn, but no variable name and what float means, where can i find the detail of all kinds of D3DFVF format

yes, directx books have the info, but how do they get it, did sb reverse the detail format?

##### Share on other sites

http://msdn.microsoft.com/en-us/library/windows/desktop/bb172559%28v=vs.85%29.aspx

You bitwise or these flags together and feed it to the device when you are rendering that particular vertex buffer. Your are better of learning how to use the programmable pipeline however as most GPU's out there support this now.

##### Share on other sites

http://msdn.microsoft.com/en-us/library/windows/desktop/bb172559%28v=vs.85%29.aspx

You bitwise or these flags together and feed it to the device when you are rendering that particular vertex buffer. Your are better of learning how to use the programmable pipeline however as most GPU's out there support this now.

i want to know the float variable name and what every float means

##### Share on other sites

What float variable name, I am not sure I understand your question actually.

Generally you do something like this

struct CustomVertex
{
float x, y, z; //position
float nx, ny, nz; //normal
float u, v; //texture coordinates
};

DWORD CustomVertexFVF = D3DFVF_XYZ | D3DFVF_NORMAL | D3DFVF_TEX0 |
D3DFVF_TEXCOORDSIZE2(0);

Edited by NightCreature83

##### Share on other sites

What float variable name, I am not sure I understand your question actually.

Generally you do something like this

struct CustomVertex
{
float x, y, z; //position
float nx, ny, nz; //normal
float u, v; //texture coordinates
}

DWORD CustomVertexFVF |= D3DFVF_XYZ | D3DFVF_NORMAL | D3DFVF_TEX0 |
D3DFVF_TEXCOORDSIZE2(0);


the float variable name is x, y, z in this structure

where does this structure come from, i can not find it on msdn

you know, when i program, i only go msdn

##### Share on other sites

You have to define this structure yourself, the DX SDK will not define this for you as it wouldn't know what needs you have for your vertex structure. Mesh data is very specific to the project it is being used in and some projects use position, normal, tangent and a couple of texture coordinate sets and others leave out the tangent data and calculate that in the shader.

What goes into the vertex buffer in the end is up to you. I could also have used this as the CustomVertex structure

struct CustomVertexColor
{
float x, y, z; //position
float nx, ny, nz; //normal
DWORD diffuse; //Diffuse color
float u, v; //texture coordinates
};

DWORD CustomVertexFVF = D3DFVF_XYZ | D3DFVF_NORMAL | D3DFVF_DIFFUSE | D3DFVF_TEX0 |
D3DFVF_TEXCOORDSIZE2(0);


The thing is I remember that you need to be careful with the order in the struct and FVF, I haven't used the Fixed Function pipeline in years so this information is a bit hazy.

Using VERTEXELEMENT9 and the D3D11 equivalents of this are far easier to manage as you are literally telling the vertex buffer how it has been laid out and you could potentially put the normal in front of the position if you wanted to.

Edited by NightCreature83

##### Share on other sites

You create that structure. And you choose what you put there because you (should) know what data you need for each verticle.

For example in tcige's code, his structure says that he wants position of each vertex (x, y, z), normal vector of each vertex (nx, ny, nz) and one set of texture coordinates of each vertex (u, v).

The FVF value must correspond to this, so it this case it is D3DFVF_XYZ | D3DFVF_NORMAL | D3DFVF_TEX0.

On the msdn page that NightCreature83 linked to, you can see what number and data types of variables does each of the FVF types need, for example "float,float,float" for  D3DFVF_XYZ. So, your structure must contain three float values (names are up to you, something like x, y, z is common).

Of course this is just the definition of the structure of your vertices. Next step is to fill them with actual data. But that's another story.

Edited by Tom KQT

##### Share on other sites

where can i find the detail of all kinds of D3DFVF format

directx 8 docs.

i've got a copy of the chart you need, but gamedev.net's editor can't paste it into this post, i'll try uploading it to my gallery or journal.

Edited by Norman Barrows

##### Share on other sites

You have to define this structure yourself, the DX SDK will not define this for you as it wouldn't know what needs you have for your vertex structure. Mesh data is very specific to the project it is being used in and some projects use position, normal, tangent and a couple of texture coordinate sets and others leave out the tangent data and calculate that in the shader.

What goes into the vertex buffer in the end is up to you. I could also have used this as the CustomVertex structure

struct CustomVertexColor
{
float x, y, z; //position
float nx, ny, nz; //normal
DWORD diffuse; //Diffuse color
float u, v; //texture coordinates
};

DWORD CustomVertexFVF = D3DFVF_XYZ | D3DFVF_NORMAL | D3DFVF_DIFFUSE | D3DFVF_TEX0 |
D3DFVF_TEXCOORDSIZE2(0);


The thing is I remember that you need to be careful with the order in the struct and FVF, I haven't used the Fixed Function pipeline in years so this information is a bit hazy.

Using VERTEXELEMENT9 and the D3D11 equivalents of this are far easier to manage as you are literally telling the vertex buffer how it has been laid out and you could potentially put the normal in front of the position if you wanted to.

thanks a lot

i do not mean that, for example, the texture

how can i known what addictional info needs in the structure except xyz

##### Share on other sites

You create that structure. And you choose what you put there because you (should) know what data you need for each verticle.

For example in tcige's code, his structure says that he wants position of each vertex (x, y, z), normal vector of each vertex (nx, ny, nz) and one set of texture coordinates of each vertex (u, v).

The FVF value must correspond to this, so it this case it is D3DFVF_XYZ | D3DFVF_NORMAL | D3DFVF_TEX0.

On the msdn page that NightCreature83 linked to, you can see what number and data types of variables does each of the FVF types need, for example "float,float,float" for  D3DFVF_XYZ. So, your structure must contain three float values (names are up to you, something like x, y, z is common).

Of course this is just the definition of the structure of your vertices. Next step is to fill them with actual data. But that's another story.

yeah, why needs u,v for texture, that's what i want to know

1. 1
Rutin
23
2. 2
3. 3
JoeJ
20
4. 4
5. 5

• 29
• 40
• 23
• 13
• 13
• ### Forum Statistics

• Total Topics
631740
• Total Posts
3001966
×