Important:
This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.
A version of this page is also available for
4/8/2010

This method is used to change the current texture map bound to texture stage.

Syntax

HRESULT SetTexture(
  DWORD 
Stage,
  IDirect3DMobileBaseTexture* 
pTexture
);

Parameters

Stage

[in] Stage identifier of the texture to retrieve. Stage identifiers are zero-based. The maximum number of texture stage states is defined in D3DM_TEXSTAGECOUNT and the number of texture stages supported by the device is in D3DMCAPS as MaxTextureBlendStages.

pTexture

[in] A pointer to an IDirect3DMobileBaseTextureinterface for the texture that will be bound to the stage identified by Stage.

The IDirect3DMobileDevice::SetTexturemethod maintains a reference to the texture map's interface so long as the texture map is bound to the stage. Setting this parameter to NULL clears the texture map currently bound to a stage.

Return Value

If the method succeeds, the return value is D3DM_OK (see D3DM Values).

If the method fails, the return value can be D3DMERR_INVALIDCALL (see D3DMERR Values).

Remarks

There are no default texture maps in Direct3D Mobile, and nothing is automatically bound to any texture stage.

This method increments the reference count of the texture surface being assigned and decrements the reference count of the previously selected texture if there is one. When the texture is no longer needed, set the texture at the appropriate stage to NULL. Failure to do this results in a memory leak.

Requirements

Header d3dm.h
Library D3dm.lib, D3dmguid.lib
Windows Embedded CE Windows CE 5.0 and later
Windows Mobile Windows Mobile Version 5.0 and later

See Also