Cg Core Runtime API cgCreateStateAssignment(3)
NAME
cgCreateStateAssignment - create a state assignment
SYNOPSIS
#include
CGstateassignment cgCreateStateAssignment( CGpass pass,
CGstate state );
PARAMETERS
pass The pass in which to create the state assignment.
state The state used to create the state assignment.
RETURN VALUES
Returns the handle to the created state assignment.
Returns NUL if an error occurs.
DESCRIPTION
cgCreateStateAssignment creates a state assignment for the
specified pass. The new state assignment is appended to the
pass' existing list of state assignments. If the state is
actually a state array, the created state assignment is
created for array index zero. Use
cgCreateStateAssignmentIndex to create state assignments for
other indices of an array state.
EXAMPLES
/* Procedurally create state assignment equivalent to */
/* "BlendFunc = { SrcAlpha, OneMinusSrcAlpha };" */
CGstate blendFuncState = cgGetNamedState(context, "BlendFunc");
CGstateassignment blendFuncSA =
cgCreateStateAssignment(pass, blendFuncState);
static const int blendFuncConfig[2] =
{ GLSRCALPHA, GLONEMINUSRCALPHA };
cgSetIntArrayStateAssignment(blendFuncSA, blendFuncConfig);
/* Procedurally create state assignment equivalent to */
/* "BlendEnable = true;" */
CGstate blendEnableState =
cgGetNamedState(context, "BlendEnable");
CGstateassignment blendEnableSA =
cgCreateStateAssignment(pass, blendEnableState);
cgSetBoolStateAssignment(blendEnableSA, CGTRUE);
ERORS
CGINVALIDPASHANDLEROR is generated if pass is not a
valid pass.
Cg Toolkit 2.1 Last change: 1
Cg Core Runtime API cgCreateStateAssignment(3)
CGINVALIDSTATEHANDLEROR is generated if state is not a
valid state.
HISTORY
cgCreateStateAssignment was introduced in Cg 1.5.
SEE ALSO
cgCreateTechnique, cgCreateSamplerStateAssignment,
cgCreateState, cgCreateStateAssignmentIndex
Cg Toolkit 2.1 Last change: 2
|