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?
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?
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.
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
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);
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
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.
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.
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.
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
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
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.
thanks for the info
where can i download the directx 8 sdk
i posted the chart from the directx8 docs in my gallery:
http://www.gamedev.net/gallery/image/3560-fvfcodes/
lemme check my code, and i'll see if i can explain what's up in my next post. i use fvf too.
>> where can i download the directx 8 sdk
its still out there on a few sites, but that image is all you need out of it. the june 2010 sdk docs cover everything else RE: fixed function and FVF codes.
if you're just starting out, you might just want to learn the newer way. its forward compatible, FVF is not.
i'll check my code and see if i can explain what's up with fvf's.
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
That's completely up to you to be honest, but there are a few things that are needed to do certain things, like:
This link should give you more information on when to use what in a vertex buffer, it also relates this information to certain features you can turn on in the Fixed Function pipeline in D3D9.
ok I found a link to the order of the structure related to the FVF again: http://p.blog.csdn.net/images/p_blog_csdn_net/yanonsoftware/fvf_order.gif
Again I advice you to start looking at the programmable pipeline instead as the Fixed Function pipeline isn't used anymore in anything but legacy code.
i posted the chart from the directx8 docs in my gallery:
http://www.gamedev.net/gallery/image/3560-fvfcodes/
lemme check my code, and i'll see if i can explain what's up in my next post. i use fvf too.
the chart is great
maybe the directx 8 header file contains the detail info of every structure
thanks for the info and advise
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
That's completely up to you to be honest, but there are a few things that are needed to do certain things, like:
- Wanna do lighting you need to provide a normal
- Wanna do texture mapping you need to provide at least one set of texture coordinates.
This link should give you more information on when to use what in a vertex buffer, it also relates this information to certain features you can turn on in the Fixed Function pipeline in D3D9.
ok I found a link to the order of the structure related to the FVF again: http://p.blog.csdn.net/images/p_blog_csdn_net/yanonsoftware/fvf_order.gif
Again I advice you to start looking at the programmable pipeline instead as the Fixed Function pipeline isn't used anymore in anything but legacy code.
thanks for the info and advise
ok, i'm only using fvf's for a test of drawing dynamically height mapped ground quads, and for drawing meshes.
for the ground quad test, i'm using this vertex format:
> maybe the directx 8 header file contains the detail info of every structure
dude, you don't get it, there ARE no structures.
you make them yourself, then use fvf codes to tell directx what you put in them.
all the possible combos would be a nightmare to deal with, so microsoft left it up to the user to declare the struct in a certain order, then uses fvf codes to tell directx how to read it.
so there isn't a "xyz,normal,uv" struct in directx at all. or any of the other possible struct declarations you could get from all possible fvf code combos.
you make the struct. the order in the chart and the fvf codes allow directx to read it correctly.
the fvf codes define what fields you can include. the docs about the fvf flags tell what they do, but they don't explain about the order of appearance in the struct very well or at all.
i've never checked to see if the flags are listed in the docs in the order that the fields must appear or not.
That depends on your render states that are setup on the device and on the material settings. If D3DRS_VERTEXCOLOR is set and lighting is also enabled it will use the per vertex color values in this calculation. By default it's set to true.
That depends on your render states that are setup on the device and on the material settings.
yes, i suspected that material was involved. when you export just a mesh by itself from truespace with uv and normals only, it does not include lighting in the vertices, so directx just uses the material (i'm pretty sure). i use global materials to control specular and diffuse when drawing scenes.
This topic has been locked by a moderator. New replies are not allowed.
With your permission, GameDev.net uses analytics cookies to understand how people use the platform. You can accept analytics or continue with necessary cookies only. Learn more