Microsoft DirectX 9.0

IDirect3DDevice9::SetTexture Method

Assigns a texture to a stage for a device.


HRESULT SetTexture(      

    DWORD Stage,     IDirect3DBaseTexture9 *pTexture );


[in] Stage identifier to which the texture is set. Stage identifiers are zero-based. The maximum number of stages supported is determined from two caps: D3DCAPS.MaxSimultaneousTextureStages and D3DCAPS9.MaxTextureBlendingStages.

Displacement Mapping uses a special stage index, called D3DDDMAPSAMPLER.

Vertex Textures use a special stage index called D3DVERTEXTEXTURESAMPLER.

[in] Pointer to an IDirect3DBaseTexture9 interface, representing the texture being set.

Return Value

If the method succeeds, the return value is D3D_OK.

If the method fails, the return value can be D3DERR_INVALIDCALL.


IDirect3DDevice9::SetTexture is not allowed if the texture is created with a pool type of D3DPOOL_SCRATCH. IDirect3DDevice9::SetTexture is not allowed with a pool type of D3DPOOL_SYSTEMMEM texture unless DevCaps is set with D3DDEVCAPS_TEXTURESYSTEMMEMORY.

See Also

IDirect3DDevice9::GetTexture, IDirect3DDevice9::GetTextureStageState, IDirect3DDevice9::SetTextureStageState

© 2002 Microsoft Corporation. All rights reserved.