NAME

cgD3D9SetUniform - set the value of a uniform parameter

SYNOPSIS

  #include <Cg/cgD3D9.h>

  HRESULT cgD3D9SetUniform( CGparameter param,
                            const void * values );

PARAMETERS

param

The parameter whose values are to be set. param must be a uniform parameter that is not a sampler.

values

The value(s) to which to set param. The amount of data required depends on the type of parameter, but is always specified as an array of one or more floating point values. The type is void* so a compatible user-defined structure can be passed in without type-casting. Use cgD3D9TypeToSize to determine how many values are required for a particular type.

RETURN VALUES

cgD3D9SetUniform returns D3D_OK if the function succeeds.

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

DESCRIPTION

cgD3D9SetUniform sets the value for a particular uniform parameter. All values should be of type float. There is assumed to be enough values to set all elements of the parameter.

EXAMPLES

The following example code illustrates the use of cgD3D9SetUniform:

  // param is a CGparameter handle of type float3
  // matrixParam is a CGparameter handle of type float2x3
  // arrayParam is a CGparameter handle of type float2x2[3]
  ...
  // intialize the data for each parameter
  D3DXVECTOR3 paramData(1,2,3);
  float matrixData[2][3] = 
  {
      0,1,2,
      3,4,5
  };
  float arrayData[3][2][2] = 
  {
      0,1,
      2,3,
      4,5,
      6,7,
      8,9,
      0,1
  };
  ...
  // set the parameters
  cgD3D9SetUniform(param, paramData);
  cgD3D9SetUniform(matrixParam, matrixData);
  // you can use arrays, but you must set the entire array
  cgD3D9SetUniform(arrayParam, arrayData);

ERRORS

CGD3D9ERR_INVALIDPARAM to-be-written

CGD3D9ERR_NODEVICE to-be-written

CGD3D9ERR_NOTLOADED to-be-written

CGD3D9ERR_NOTUNIFORM to-be-written

CGD3D9ERR_NULLVALUE to-be-written

HISTORY

cgD3D9SetUniform was introduced in Cg to-be-written.

SEE ALSO

cgD3D9SetUniformArray, cgD3D9SetUniformMatrix, cgD3D9SetUniformMatrixArray, cgD3D9TypeToSize