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

> ## Name

> cgGetStateContext - get a state's context

> ## Synopsis

>     #include <Cg/cg.h>

>     CGcontext cgGetStateContext( CGstate state );

> ## Parameters

> state
>   The state.

> ## Return Values

> Returns the context to which state belongs.

> Returns NULL if an error occurs.

> ## Description

> cgGetStateContext allows the application to retrieve the context of a state. This is the context used to create the state with cgCreateState.

> ## Examples

>     CGcontext context = cgCreateContext();
>     CGstate state = cgCreateState(context, "GreatStateOfTexas", CG_FLOAT);
>     assert(context == cgGetStateContext(state));

> ## Errors

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

> ## History

> cgGetStateContext was introduced in Cg 1.5.

> ## See Also

> cgCreateState, cgCreateArrayState, cgGetEffectContext, cgGetParameterContext, cgGetProgramContext