IDirect3DDevice8::SetTexture

DirectX8

IDirect3DDevice8::SetTexture
 
Microsoft DirectX 8.1 (C++)

IDirect3DDevice8::SetTexture

Assigns a texture to a stage for a device.

HRESULT SetTexture(
  DWORD Stage,
  IDirect3DBaseTexture8* pTexture
);

Parameters

Stage
[in] Stage identifier to which the texture is set. Stage identifiers are zero-based. Devices can have up to eight set textures, so the maximum value allowed for Stage is 7.
pTexture
[in] Pointer to an IDirect3DBaseTexture8 interface, representing the texture being set. For complex textures, such as mipmaps and cube textures, this parameter must point to the top-level surface.

Return Values

If the method succeeds, the return value is D3D_OK.

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

Remarks

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: Declared in D3d8.h.
  Import Library: Use D3d8.lib.

See Also

IDirect3DDevice8::GetTexture, IDirect3DDevice8::GetTextureStageState, IDirect3DDevice8::SetTextureStageState