Name
cgSetParameter - sets the value of scalar and vector parameters
Synopsis
#include <Cg/cg.h>
/* TYPE is int, float or double */
void cgSetParameter1{ifd}( CGparameter param,
TYPE x );
void cgSetParameter2{ifd}( CGparameter param,
TYPE x,
TYPE y );
void cgSetParameter3{ifd}( CGparameter param,
TYPE x,
TYPE y,
TYPE z );
void cgSetParameter4{ifd}( CGparameter param,
TYPE x,
TYPE y,
TYPE z,
TYPE w );
void cgSetParameter{1234}{ifd}v( CGparameter param,
const TYPE * v );
Parameters
- param
-
The parameter that will be set.
- x, y, z, and w
-
The values to which to set the parameter.
- v
-
The values to set the parameter to for the array versions
of the set functions.
Return Values
None.
Description
The cgSetParameter functions set the value of
a given scalar or vector parameter. The functions are available
in various combinations.
Each function takes either 1, 2, 3, or
4 values depending on the function that is used. If more values
are passed in than the parameter requires, the extra values will
be ignored.
There are versions of each function that take int, float or
double values signified by the i, f or d in the function name.
The functions with the v at the end of their names take an array
of values instead of explicit parameters.
Once cgSetParameter has been used to set a parameter,
the values may be retrieved from the parameter using the CG_CURRENT
enumerant with cgGetParameterValues.
If an API-dependant layer of the Cg runtime (e.g. cgGL) is used, these
entry points may end up making API (e.g. OpenGL) calls.
Note: Previous releases of Cg allowed you to store more values in a parameter than
indicated by the parameter's type. For example, one could use
cgGLSetParameter4f to
store four values into a parameter of type CG_FLOAT (not CG_FLOAT4). All four
values could later be retrieved using a get call which requested more than one value. However, this feature conflicts with the GLSL approach and also leads to issues with parameters mapped into BUFFERS. Therefore, beginning with Cg 2.0 any components beyond the number indicated by the parameter type are ignored.
Examples
to-be-written
Errors
CG_INVALID_PARAM_HANDLE_ERROR is generated if param is not a valid parameter.
CG_INVALID_PARAMETER_ERROR is generated if param is a varying input
to a fragment program.
History
The d and f versions of cgSetParameter were introduced in Cg 1.2.
The i versions of cgSetParameter were introduced in Cg 1.4.
See Also
cgGetParameterValue
|