Texture Coordinate Transformation (Windows CE 5.0)
The flexible vertex format (FVF) allows you to specify texture coordinates for each vertex, see Vertex Data Description. Additionally, each vertex may have multiple sets of texture coordinates. Each set of texture coordinates may have one to three values with a maximum of four coordinate sets.
Texture coordinate representation is encoded into the FVF value for the vertex buffer that contains the coordinates.
The transformation layer is also capable of generating sets of texture coordinates. Texture coordinates may be generated according to different algorithms.
To specify the texture coordinates for a stage, you must add a flag to the value of the D3DMTSS_TEXCOORDINDEX texture stage state (see D3DMTEXTURESTAGESTATETYPE). This flag must be one of the D3DMTSS_TCI Values, each of which specifies a different coordinate generation algorithm.
All generated texture coordinate sets have three values. The device may generate texture coordinates in whatever data format is convenient, with the exception of texture coordinates generated for IDirect3DMobileDevice::ProcessVertices. In this case the device must generate texture coordinates in the format specified by the output FVF.
The transformation layer is capable of translating vertex texture coordinate sets to texture stages. The low 16 bits of the texture stage state D3DMTSS_TEXCOORDINDEX identify the coordinate set bound to the given texture stage. The translation occurs before the texture stage's transformation.
Generated coordinates are bound to a texture stage number. If the texture coordinates for a stage are generated, then there is no way to bind a vertex coordinate set to a stage, and the low 16 bits are used for wrapping render states. For more detail on regarding wrapping generated texture coordinates, see Texture Coordinate Wrapping.
Direct3D Mobile also supports multiplying the texture coordinates for a given stage by a transformation matrix, after the coordinates are generated or bound. Each stage may specify its own transformation matrix using the IDirect3DMobileDevice::SetTransform method with D3DMTS_TEXTURE0 through D3DMTS_TEXTURE3 flags.
You may also control when the transformation matrix is applied via the D3DMTSS_TEXTURETRANSFORMFLAGS texture stage state. This set of flags indicates if transformations are enabled for the given stage, how many of the output coordinates are passed to the rasterizer, and if projective texturing is to be used.
Send Feedback on this topic to the authors