Texture Resources (Windows Embedded CE 6.0)

1/6/2010

Texture resources are implemented in the IDirect3DMobileTexture interface. To obtain a pointer to a texture interface, call the IDirect3DMobileDevice::CreateTexture method.

Microsoft® Direct3D® Mobile supports multiple texture blending through the concept of texture stages. Each texture stage contains a texture and operations that can be performed on the texture. The textures in the texture stages form the set of current textures. For more information, see Multiple Texture Blending. The state of each texture is encapsulated in its texture stage.

The state of each texture must be set with the IDirect3DMobileDevice::SetTextureStageState method. Pass the stage number (0-3) as the value of the first parameter. Set the value of the second parameter to a member of the D3DMTEXTURESTAGESTATETYPE enumerated type. The final parameter is the state value for the particular texture state.

Using texture interface pointers, your application can render a blend of up to four textures. Set the current textures by invoking the IDirect3DMobileDevice::SetTexture method. Direct3D Mobile blends all current textures onto the primitives that it renders.

Note

The SetTexture method increments the reference count of the texture surface being assigned. When the texture is no longer needed, you should set the texture at the appropriate stage to NULL. If you fail to do this, the surface will not be released, resulting in a memory leak.

Your application can set the texture wrapping state for the current textures by calling the IDirect3DMobileDevice::SetRenderState method. Pass a value from D3DMRS_WRAP0 through D3DRR_WRAP3 (see D3DMRENDERSTATETYPE) as the value of the first parameter, and use a combination of the D3DWRAPCOORD_0, D3DWRAPCOORD_1, D3DWRAPCOORD_2, and D3DWRAPCOORD_3 flags to enable wrapping in the u, v, or w directions.

Your application can also set the texture perspective and texture filtering states. See Texture Filtering.

See Also

Concepts

Textures