Name
cgGLSetParameter - set the values of a scalar or vector parameter
Synopsis
#include <Cg/cgGL.h>
/* TYPE is float or double */
void cgGLSetParameter1{fd}( CGparameter param,
TYPE x );
void cgGLSetParameter2{fd}( CGparameter param,
TYPE x,
TYPE y );
void cgGLSetParameter3{fd}( CGparameter param,
TYPE x,
TYPE y,
TYPE z );
void cgGLSetParameter4{fd}( CGparameter param,
TYPE x,
TYPE y,
TYPE z,
TYPE w );
void cgGLSetParameter{1234}{fd}v( CGparameter param,
const TYPE * v );
Parameters
- param
-
The parameter that will be set.
- x, y, z, and w
-
The values used to set the parameter.
- v
-
An array of values used to set the parameter for the array versions
of the set functions.
Return Values
None.
Description
The cgGLSetParameter functions set the value of
a scalar or vector parameter.
The function takes either 1, 2, 3, or 4 values depending on which
version 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 either float or
double values signified by f or d in the function name.
The functions with v at the end of their names take an array
of values instead of explicit parameters.
The cgGLSetParameter functions may be called with
either uniform or varying parameters. When called with a varying
parameter, the appropriate immediate mode OpenGL entry point will
be called. However, the cgGLGetParameter functions
will only work with uniform parameters.
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
cgGLSetParameter1f(param, x);
cgGLSetParameter1d(param, x);
cgGLSetParameter2f(param, x, y);
cgGLSetParameter2d(param, x, y);
cgGLSetParameter3f(param, x, y, z);
cgGLSetParameter3d(param, x, y, z);
cgGLSetParameter4f(param, x, y, z, w);
cgGLSetParameter4d(param, x, y, z, w);
cgGLSetParameter1fv(param, &v);
cgGLSetParameter1dv(param, &v);
cgGLSetParameter2fv(param, &v);
cgGLSetParameter2dv(param, &v);
cgGLSetParameter3fv(param, &v);
cgGLSetParameter3dv(param, &v);
cgGLSetParameter4fv(param, &v);
cgGLSetParameter4dv(param, &v);
Errors
CG_INVALID_PROFILE_ERROR is generated if param's profile is not
a supported OpenGL profile.
CG_INVALID_PARAM_HANDLE_ERROR is generated if param is not a valid parameter.
CG_INVALID_PARAMETER_ERROR is generated if the parameter fails to
set for any other reason.
History
The cgGLSetParameter functions were introduced in Cg 1.1.
See Also
cgGLGetParameter,
cgGLSetParameterArray,
cgGLSetMatrixParameter,
cgGLSetMatrixParameterArray,
cgGLSetTextureParameter,
cgGLBindProgram
|