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

cgCreateStateAssignment returns the handle to the created state assignment.

DESCRIPTION

cgCreateStateAssignment creates a state assignment for the specified pass. The new state assignment is appended to the pass's 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

If the pass handle is invalid, returns the invalid handle zero.

If the state handle is invalid, returns the invalid handle zero.

HISTORY

cgCreateStateAssignment was introduced in Cg 1.5.

SEE ALSO

cgCreateTechnique, cgCreateSamplerStateAssignment, cgCreateState, cgCreateStateAssignmentIndex