NAME

cgCreateStateAssignmentIndex - create a state assignment from a state array

SYNOPSIS

  #include <Cg/cg.h>

  CGstateassignment cgCreateStateAssignmentIndex( CGpass pass,
                                                  CGstate state,
                                                  int ndx );

PARAMETERS

pass

The pass in which to create the state assignment.

state

The state array used to create the state assignment.

ndx

The index for the array state.

RETURN VALUES

cgCreateStateAssignmentIndex 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. The state assignment is the given index (ndx) for the array state specified.

EXAMPLES

This example shows how to create a state assignment for enabling light 5:

  // Procedurally create state assignment equivalent to
  // "LightEnable[5] = 1;"
  CGstate lightEnableState = cgGetNamedState(context, "LightEnable");
  CGstateassignment light5sa =
      cgCreateStateAssignmentIndex(pass, lightEnableState , 5);
  cgSetBoolStateAssignment(light5sa, 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.

If the ndx is negative, returns the invalid handle zero.

If the ndx is greater than or equal the number of elements for the state array, returns the invalid handle zero.

HISTORY

cgCreateStateAssignmentIndex was introduced in Cg 1.5.

SEE ALSO

cgCreateTechnique, cgCreateSamplerStateAssignment, cgCreateState, cgCreateStateAssignment