DirectX SDK

Setting and Retrieving Texture Coordinate Transformations

[C++]

Like the matrices that your application uses for geometry, you set and retrieve texture coordinate transformations by calling the IDirect3DDevice7::SetTransform and IDirect3DDevice7::GetTransform methods. These methods accept the D3DTRANSFORMSTATE_TEXTURE0 through D3DTRANSFORMSTATE_TEXTURE7 members of the D3DTRANSFORMSTATETYPE enumerated type to identify the transformation matrices for texture stages 0 through 7, respectively.

The following code sets a matrix to be applied to the texture coordinates for texture stage 0.

// For this example, the lpd3dDevice variable contains a 
// valid pointer to an IDirect3DDevice7 interface.

D3DMATRIX matTrans  = D3DUtil_SetIdentityMatrix(); // declared in d3dutil.h

// Set-up the matrix for the desired transformation.
lpd3dDevice->SetTransform(D3DTRANSFORMSTATE_TEXTURE0, &matTrans);
[Visual Basic]

Like the matrices that your application uses for geometry, you set and retrieve texture coordinate transformations by calling the Direct3DDevice7.SetTransform and Direct3DDevice7.GetTransform methods. These methods accept the D3DTRANSFORMSTATE_TEXTURE0 through D3DTRANSFORMSTATE_TEXTURE7 members of the CONST_D3DTRANSFORMSTATETYPE enumeration to identify the transformation matrices for texture stages 0 through 7, respectively.

The following code sets a matrix to be applied to the texture coordinates for texture stage 0.

' For this example, the d3dDevice variable contains a
' valid reference to a Direct3DDevice7 object, and
' dx contains a valid reference to a DirectX7 object.
Dim matTrans As D3DMATRIX
Call dx.IdentityMatrix(matTrans)

' Set-up the matrix for the desired transformation.
Call d3dDevice.SetTransform(D3DTRANSFORMSTATE_TEXTURE0, matTrans)