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

> ## Name

> cgCreateArrayState - create an array-typed state definition

> ## Synopsis

>     #include <Cg/cg.h>

>     CGstate cgCreateArrayState( CGcontext context,
>                                 const char * name,
>                                 CGtype type,
>                                 int nelements );

> ## Parameters

> context
>   The context in which to define the state.
> name
>   The name of the new state.
> type
>   The type of the new state.
> nelements
>   The number of elements in the array.

> ## Return Values

> Returns a handle to the newly created CGstate.

> Returns NULL if there is an error.

> ## Description

> cgCreateArrayState adds a new array-typed state definition to context. Before a CgFX file is added to a context, all state assignments in the file must have previously been defined via a call to cgCreateState or cgCreateArrayState.

> Applications will typically call cgSetStateCallbacks shortly after creating a new state with cgCreateArrayState.

> ## Examples

> to-be-written

> ## Errors

> CG_INVALID_CONTEXT_HANDLE_ERROR is generated if context is not a valid context.

> CG_INVALID_PARAMETER_ERROR is generated if name is NULL or not a valid identifier, if type is not a simple scalar, vector, or matrix-type, or if nelements is not a positive number.

> ## History

> cgCreateArrayState was introduced in Cg 1.4.

> ## See Also

> cgGetStateContext, cgGetStateName, cgGetStateType, cgIsState, cgSetStateCallbacks, cgGLRegisterStates