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

> ## Name

> cgGetFirstParameter - get the first parameter in a program

> ## Synopsis

>     #include <Cg/cg.h>

>     CGparameter cgGetFirstParameter( CGprogram program,
>                                      CGenum name_space );

> ## Parameters

> program
>   The program from which to retrieve the first parameter.
> name_space
>   Specifies the parameter namespace through which to iterate. Currently CG_PROGRAM and CG_GLOBAL are supported.

> ## Return Values

> Returns the first CGparameter object in program.

> Returns zero if program is invalid or if program does not have any parameters.

> Also returns zero if program is a combined program. To access the parameters of a combined program, use cgGetProgramDomainProgram to get each domain program and then call cgGetFirstParameter on each domain program.

> ## Description

> cgGetFirstParameter returns the first top-level parameter in a program. cgGetFirstParameter is used for recursing through all parameters in a program. See cgGetNextParameter for more information on parameter traversal.

> ## Examples

>     CGparameter param = cgGetFirstParameter( program, CG_GLOBAL );
>     while ( param )
>     {
>       /* Do stuff with leaf */
>       param = cgGetNextParameter( param );
>     }

> ## Errors

> CG_INVALID_PROGRAM_HANDLE_ERROR is generated if program is not a valid program handle.

> CG_INVALID_ENUMERANT_ERROR is generated if name_space is not CG_PROGRAM or CG_GLOBAL.

> ## History

> cgGetFirstParameter was introduced in Cg 1.1.

> ## See Also

> cgGetNextParameter, cgGetProgramDomainProgram, cgGetFirstDependentParameter, cgGetFirstEffectParameter, cgGetFirstParameterAnnotation