Export (0) Print
Expand All
Expand Minimize


Windows Mobile 6.5
A version of this page is also available for

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

HRESULT SetTexture(
  DWORD Stage,
  IDirect3DMobileBaseTexture* pTexture


[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.


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

The IDirect3DMobileDevice::SetTexture method 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.

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).

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.

LibraryD3dm.lib, D3dmguid.lib
Windows Embedded CEWindows CE 5.0 and later
Windows MobileWindows Mobile Version 5.0 and later

Community Additions

© 2014 Microsoft