cgCreateStateAssignmentIndex

> # NAME

> cgCreateStateAssignmentIndex - create a state assignment for a state array

> # SYNOPSIS

>       #include <Cg/cg.h>

>       CGstateassignment cgCreateStateAssignmentIndex( CGpass pass,
>                                                       CGstate state,
>                                                       int index );

> # PARAMETERS

> pass

>   The pass in which to create the state assignment.

> state

>   The state array used to create the state assignment.

> index

>   The index for the state array.

> # RETURN VALUES

> Returns the new state assignment handle.

> Returns NULL if an error occurs.

> # DESCRIPTION

> cgCreateStateAssignmentIndex 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 for the given index of for the specified array state.

> # 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

> 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.

> If the index is negative or index is greater than or equal the number of elements for the state array, no error is generated but NULL is returned.

> # HISTORY

> cgCreateStateAssignmentIndex was introduced in Cg 1.5.

> # SEE ALSO

> cgGetStateAssignmentIndex, cgCreateTechnique, cgCreateSamplerStateAssignment, cgCreateState, cgCreateStateAssignment