Archived

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

ofer

FVF and tex coordinate sizes

Recommended Posts

hi there. here is my my fvf- (D3DFVF_XYZ|D3DFVF_NORMAL|D3DFVF_TEX2|D3DFVF_TEXCOORDSIZE1(D3DFVF_TEXTUREFORMAT2)|D3DFVF_TEXCOORDSIZE2(D3DFVF_TEXTUREFORMAT3)) this is supposed to describe the next vertex structure- struct Vertex { vector3 position; vector3 normal; D3DXVECTOR2 TexCoord0; vector3 TexCoord1; }; well, when trying to lock the vertex buffer, i get an error that i tried to lock more than the buffer''s size. i.e. VertexNum*sizeof(Vertex)>VertexNum*sizeof(FVF) you see what i mean? my fvf describes a smaller vertex than my vertex data. just to let you know, i generate my VB using CloneMeshFVF(), and than copying the VB from it. any idea what should my FVF look like?

Share this post


Link to post
Share on other sites
I think the correct FVF for the struct would be :

(D3DFVF_XYZ|D3DFVF_NORMAL|D3DFVF_TEX2|D3DFVF_TEXCOORDSIZE2(0)|D3DFVF_TEXCOORDSIZE3(1))

What you had wrong (i think) was that you thought D3DFVF_TEXCOORDSIZE1 described the size of the texture coordinate for unit 1 and same mistake for unit two

I could be wrong but I think D3DFVF_TEXCOORDSIZE1 actually describes the texture unit supplied as a parameter as a 1d tex coord, D3DFVF_TEXCOORDSIZE2 as a 2d and so on. (note 1st texture unit has index 0).

[edited by - Grambo on July 27, 2002 5:55:35 AM]

Share this post


Link to post
Share on other sites
thnx, that was the problem. now the model is drawn correctly. now i just need to get the function D3DXComputeTangent to work. it returns DS_OK but doesnt compute anything.

Share this post


Link to post
Share on other sites