Partager via


IDirect3DDevice8::SetTexture

This method 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

OS Versions: Windows CE .NET 4.0 and later.
Header: D3d8.h.
Link Library: D3d8.lib.

See Also

IDirect3DBaseTexture8 | IDirect3DDevice8::GetTexture | IDirect3DDevice8::GetTextureStageState | IDirect3DDevice8::SetTextureStageState | IDirect3DDevice8

 Last updated on Thursday, April 08, 2004

© 1992-2003 Microsoft Corporation. All rights reserved.