cgGetNextState
Keywords: cgGetNextState, NVIDIA, NVIDIA Cg Toolkit, Cg Toolkit, Shader, Shader Programming, GPU Shader Programming, GPU Program

> ## Name

> cgGetNextState - iterate through states in a context

> ## Synopsis

>     #include <Cg/cg.h>

>     CGstate cgGetNextState( CGstate state );

> ## Parameters

> state
>   The current state.

> ## Return Values

> Returns the next state in the context's internal sequence of states.

> Returns NULL when state is the last state in the context.

> ## Description

> The states within a context can be iterated over using cgGetNextState.

> Note that no specific order of traversal is defined by this mechanism. The only guarantee is that each state will be visited exactly once. No guarantees can be made if states are created or deleted during iteration.

> ## Examples

>     CGstate state = cgGetFirstState( context );
>     while( state )
>     {
>       /* do something with state */
>       state = cgGetNextState( state );
>     }

> ## Errors

> CG_INVALID_STATE_HANDLE_ERROR is generated if state is not a valid state.

> ## History

> cgGetNextState was introduced in Cg 1.4.

> ## See Also

> cgGetFirstState, cgGetNamedState, cgCreateState, cgIsState