Expand Minimize

IDirect3DDevice9::SetTexture method

Assigns a texture to a stage for a device.

Syntax


HRESULT SetTexture(
  [in]  DWORD Sampler,
  [in]  IDirect3DBaseTexture9 *pTexture
);

Parameters

Sampler [in]

Type: DWORD

Zero based sampler number. Textures are bound to samplers; samplers define sampling state such as the filtering mode and the address wrapping mode. Textures are referenced differently by the programmable and the fixed function pipeline:

  • Programmable shaders reference textures using the sampler number. The number of samplers available to a programmable shader is dependent on the shader version. For vertex shaders, see Sampler (Direct3D 9 asm-vs). For pixel shaders see Sampler (Direct3D 9 asm-ps).
  • The fixed function pipeline on the other hand, references textures by texture stage number. The maximum number of samplers is determined from two caps: MaxSimultaneousTextures and MaxTextureBlendStages of the D3DCAPS9 structure.

There are two other special cases for stage/sampler numbers.

pTexture [in]

Type: IDirect3DBaseTexture9*

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

Return value

Type: HRESULT

If the method succeeds, the return value is D3D_OK. If the method fails, the return value can be D3DERR_INVALIDCALL.

Remarks

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

Requirements

Header

D3D9.h

Library

D3D9.lib

See also

IDirect3DDevice9
GetTexture
GetTextureStageState
SetTextureStageState

 

 

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.