Problem creating the FVF macros for the vertex structures
Hi, I am trying to create a vertex structure, but I get an error saying, "'|': unexpected in macro formal parameter list" for this code:
#define VERTEX_FVF( D3DFVF_XYZ | D3DFVF_NORMAL | D3DFVF_TEX1 )
After that error, I also get errors for the 'D', then the next '|' and it continues through all of them. The only thing I can think of, is that the program doesn't know where the parameters came from. I thought they were included when linking some of the directx libs, so I found the d3d9types.h file, where they are defined, and I included that file at the top of the page, but it still had the same errors. I'm using VS.NET '03, and I'm still new to it, and how you link files to it. If anyone has experienced this before, or has any idea of what I am doing wrong, please reply.
Thanks,
Kevin
You need a space between VERTEX_FVF and the paren.
It thinks you are creating a macro that takes parameters:
#define macro(x) (x + 1)
It thinks you are creating a macro that takes parameters:
#define macro(x) (x + 1)
You can use FVF like follow. Choose which is useful for you. In your example you forget space after VERTEX_FVF. ;)
#define VertexFVF (D3DFVF_XYZ | D3DFVF_NORMAL | D3DFVF_TEX1)
//or
const DWORD VertexFVF =(D3DFVF_XYZ | D3DFVF_NORMAL | D3DFVF_TEX1);
lpDevice->CreateVertexBuffer( dwNumPolygonIndex*3*sizeof(CUSTOMVERTEX),
0, VertexFVF,D3DPOOL_SYSTEMMEM, &lpVertexBuffer, NULL );
#define VertexFVF (D3DFVF_XYZ | D3DFVF_NORMAL | D3DFVF_TEX1)
//or
const DWORD VertexFVF =(D3DFVF_XYZ | D3DFVF_NORMAL | D3DFVF_TEX1);
lpDevice->CreateVertexBuffer( dwNumPolygonIndex*3*sizeof(CUSTOMVERTEX),
0, VertexFVF,D3DPOOL_SYSTEMMEM, &lpVertexBuffer, NULL );
Quote:Original post by 3ddreams
const DWORD VertexFVF =(D3DFVF_XYZ | D3DFVF_NORMAL | D3DFVF_TEX1);
And then you don't need the parenthesis around the FVF terms.
Quote:Original post by ET3DQuote:Original post by 3ddreams
const DWORD VertexFVF =(D3DFVF_XYZ | D3DFVF_NORMAL | D3DFVF_TEX1);
And then you don't need the parenthesis around the FVF terms.
You dont need the Patenthesis, but it makes the code look better in my opinion.
Perhaps it is clearer to place the FVF inside the vertex class/struct
class Vertex{public: vector pos; vector normal; enum{ FVF = D3DFVF_XYZ | D3DFVF_NORMAL };};lpDevice->CreateVertexBuffer( dwNumPolygonIndex*3*sizeof(Vertex),0, Vertex::FVF,D3DPOOL_SYSTEMMEM, &lpVertexBuffer, NULL );
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement