NAME

cgD3D9SetTexture - set the texture for a sampler parameter

SYNOPSIS

  #include <Cg/cgD3D9.h>

  HRESULT cgD3D9SetTexture( CGparameter param,
                            IDirect3DBaseTexture9 * texture );

PARAMETERS

param

The parameter whose values are to be set. It must be a sampler.

texture

Pointer to an IDirect3DBaseTexture9, the texture to set for param.

RETURN VALUES

cgD3D9SetTexture returns D3D_OK if the function succeeds.

If the function fails due to a D3D call, that D3D failure code is returned.

DESCRIPTION

cgD3D9SetTexture sets the texture for a sampler parameter.

When parameter shadowing is enabled, the D3D runtime will maintain a reference (via AddRef()) to texture, so care must be taken to set the parameter back to NULL when the texture is no longer needed. Otherwise the reference count will not reach zero and the texture's resources will not get destroyed. When destroying the program that the parameter is associated with, all references to these textures are automatically removed.

EXAMPLES

The following example code illustrates the use of cgD3D9SetTexture:

  // param is a CGparameter handle of type sampler
  // tex is an IDirect3DTexture9* intialized elswhere
  ...
  cgD3D9SetTexture(param, tex);

ERRORS

CGD3D9ERR_INVALIDPARAM to-be-written

CGD3D9ERR_INVALIDPROFILE to-be-written

CGD3D9ERR_NODEVICE to-be-written

CGD3D9ERR_NOTLOADED to-be-written

CGD3D9ERR_NOTSAMPLER to-be-written

CGD3D9ERR_NOTUNIFORM to-be-written

CGD3D9ERR_NULLVALUE to-be-written

HISTORY

cgD3D9SetTexture was introduced in Cg to-be-written.

SEE ALSO

cgD3D9SetSamplerState, cgD3D9SetTextureWrapMode