Texture Coordinate Formats (Windows CE 5.0)

Send Feedback

Texture coordinates in Microsoft® Direct3D® Mobile can include one, two, three, or four floating point elements to address textures with varying levels of dimension. A 1-D texture — a texture surface with dimensions of 1-by-n texels — is addressed by one texture coordinate. The most common case, 2-D textures, are addressed with two texture coordinates commonly called u and v.

As described in Vertex Data Description, applications encode texture coordinates in the vertex format. The vertex format can include multiple sets of texture coordinates. Use the D3DMFVF_TEX0 through D3DMFVF_TEX4 flexible vertex format flags (see D3DMFVF Values) to describe a vertex format that includes no texture coordinates, or as many as four sets.

The D3DMFVF_TEXCOORDSIZE Macros set of macros create bit patterns that describe the number of elements used by a particular set of texture coordinates in the vertex format. These macros accept a single parameter that identifies the index of the coordinate set whose number of elements is being defined. The following code example shows how these macros are used.

// This vertex format contains two sets of texture coordinates.
// The first set (index 0) has 2 elements, and the second set 
// has 1 element. The description for this vertex format would be: 
//   dwFVF = D3DMFVF_XYZ  | D3DMFVF_NORMAL | D3DMFVF_DIFFUSE |
//           D3DMFVF_TEX2 | D3DMFVF_TEXCOORDSIZE2(0) |
//           D3DMFVF_TEXCOORDSIZE1(1); 
//
typedef struct CVF
{
    D3DMVECTOR position;
    D3DMVECTOR normal;
    D3DMCOLOR  diffuse;
    float     u, v;   // 1st set, 2-D
    float     t;      // 2nd set, 1-D
} CustomVertexFormat;

Note   Rasterizers cannot address textures by using any more than two elements. Applications can supply up to three elements for a texture coordinate, but only if the D3DTTFF_PROJECTED texture transform flag (see D3DMTEXTURETRANSFORMFLAGS) is used. The D3DTTFF_PROJECTED flag causes the rasterizer to divide the first two elements by the third (or nth) element. For more information, see Texture Coordinate Transformations.

See Also

Texture Coordinates

Send Feedback on this topic to the authors

Feedback FAQs

© 2006 Microsoft Corporation. All rights reserved.