NAME
cgCreateStateAssignment - create a state assignment
SYNOPSIS
#include <Cg/cg.h> 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 NULL 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] = { GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA }; cgSetIntArrayStateAssignment(blendFuncSA, blendFuncConfig); /* Procedurally create state assignment equivalent to */ /* "BlendEnable = true;" */ CGstate blendEnableState = cgGetNamedState(context, "BlendEnable"); CGstateassignment blendEnableSA = cgCreateStateAssignment(pass, blendEnableState); cgSetBoolStateAssignment(blendEnableSA, CG_TRUE);ERRORS
CG_INVALID_PASS_HANDLE_ERROR is generated if pass is not a valid pass.
CG_INVALID_STATE_HANDLE_ERROR is generated if state is not a valid state.
HISTORY
cgCreateStateAssignment was introduced in Cg 1.5.
SEE ALSO
cgCreateTechnique, cgCreateSamplerStateAssignment, cgCreateState, cgCreateStateAssignmentIndex