Texture Coordinate Processing
A version of this page is also available for
4/8/2010
The following illustration shows the path taken by the texture coordinates from their source, through processing, and to the rasterizer.
There are two sources from which the system can draw texture coordinates. For a given texture stage, you can use texture coordinates included in the vertex format (D3DMFVF_TEX1 through D3DMFVF_TEX4, see D3DMFVF Values). If the D3DMTSS_TEXTURETRANSFORMFLAGS texture stage state (see D3DMTEXTURESTAGESTATETYPE) for the current texture stage is set to D3DMTTFF_DISABLE (the default setting, see D3DMTEXTURETRANSFORMFLAGS), input coordinates are not transformed. If D3DMTSS_TEXTURETRANSFORMFLAGS is set to any other value, the transformation matrix for that stage is applied to the input coordinates.
The D3DMTEXTURETRANSFORMFLAGS enumerated type defines valid values for the D3DMTSS_TEXTURETRANSFORMFLAGS texture-stage state. With the exception of the D3DMTTFF_DISABLE flag, which bypasses texture coordinate transformation, the values defined in this enumeration configure the number of output coordinates that the system passes to the rasterizer. The D3DMTTFF_COUNT1 through D3DMTTFF_COUNT3 flags instruct the system to pass one, two, or three elements from the output coordinates to the rasterizer. Currently 1-D texture coordinates are not supported.
The D3DMTTFF_PROJECTED flag is special: it tells the system that the texture coordinates are for a projected texture. Combine the D3DMTTFF_PROJECTED flag with another member of D3DTMEXTURETRANSFORMFLAGS to instruct the rasterizer to divide all the elements by the last element before rasterization takes place. For example, when explicitly using three-element texture coordinates, or when transformation results in a three-element texture coordinate, you can combine the D3DMTTFF_COUNT3 and D3DMTTFF_PROJECTED flags to cause the rasterizer to divide the first two elements by the last, producing 2-D texture coordinates required to address a 2-D texture.
Note
Rasterizers cannot address textures by using texture coordinates with more than two elements. If you specify more elements than can be used to address the current texture for that stage, the extraneous elements are ignored. This also applies when using 2-D texture coordinates for a 1-D texture.