FVF Update

The FVF codes originally defined in DirectX 6.0 now support the specifications for texture coordinate sets in DirectX 7.0.

In addition to the normal 2D textures, supported in DirectX 6.0, DirectX 7.0 supports 1D, 3D, and 4D textures. In addition, the textures may be projected. The dwVertexType member of D3DHAL_DRAWPRIMITIVES2DATA can be examined when D3dDrawPrimitives2 is called, to determine the dimensions of each texture coordinate set.

For example, if there is a vertex with five texture coordinate sets, each one of these textures can be 1D, 2D, 3D, or 4D and they may be projected textures. Each texture stage is independent, so the dimensions can be different for each set of coordinates. The upper 16 bits of the FVF flag contained in dwVertexType can be examined to determine the dimensions of the texture coordinates.

The texture coordinate count is a 4-bitfield that can range from zero through eight. This gives the number of texture coordinate sets given in the upper 16 bits of the word. The upper 16 bits of the FVF code are allocated as two bits each for each of eight texture coordinate sets. The meaning of the texture coordinate bits is as follows:




Two-dimensional texture coordinate pair, (u, v) as in DirectX 6.0



Three-dimensional texture coordinate triple, (u, v, q)



Four-dimensional texture coordinate quadruple, (u, v, w, q)



One-dimensional texture coordinate, u

3D texture coordinate sets can be used for any of three different purposes: projected textures (signaled by D3DTTFF_PROJECTED - see D3DTEXTURETRANSFORMFLAGS in the DirectX SDK documentation), volume textures, or cube map vector textures, as determined by a set of render states analogous to the D3DRENDERSTATE_WRAP0 to D3DRENDERSTATE_WRAP7 modes that are already specified on a texture coordinate set basis.

The flags used with the D3DRENDERSTATE_WRAPn render states for 1D through 4D texture coordinates, respectively, are described in the following table.

Flags Meaning


Same as D3DWRAP_U, which specifies wrapping in the u coordinate direction.


Same as D3DWRAP_V, which specifies wrapping in the v coordinate direction.


Specifies wrapping in the w coordinate direction.


Specifies wrapping in the q coordinate direction.

When projected textures are in use, they take the RHW value from the corresponding texture coordinate field, instead of from the position field. However, the position field's RHW is still used for both w-buffering and fog calculations, and therefore must be provided when either of these is in use.