Archived

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

johnnyBravo

Texture coordinates and texture stages

Recommended Posts

Hi i just read somewhere that you can assign more than one texture coordinate per vertex. If so could some tell me how to add the extra texture coordinates to a vertex structure, eg struct CUSTOMVERTEX { float x,y,z, tu,tv //would i just keep adding more tu2,tv2, tu3, tv3 }; and how would i work the fvf? thanksm

Share this post


Link to post
Share on other sites
D3DFVF_XYZ | D3DFVF_TEXn | D3DFVF_TEXCOORDSIZEa(b)

In TEXn you replace n with the number of coordinates.

In TEXCOORDSIZEa(b) replace a with a size 1, 2, 3, or 4, and b identifies which coordinate you''re setting the size of. They default to 2.

For example:
u1,v1, u2, v2, w2, u3
D3DFVF_TEX3 | D3DFVF_TEXCOORDSIZE3(2) | D3DFVF_TEXCOORDSIZE1(3)

You must then SetTextureStageState(n, D3DTSS_TEXCOORDINDEX, m)
which says on stage n, use texture coordiante set m. In addition to the UVs you''ve created you can ask D3D to provide you with normals, reflection vectors, or positions using this call.

Share this post


Link to post
Share on other sites