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

> ## Name

> cgGetFirstLeafParameter - get the first leaf parameter in a program

> ## Synopsis

>     #include <Cg/cg.h>

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

> ## Parameters

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

> ## Return Values

> Returns the first leaf CGparameter object in program.

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

> ## Description

> cgGetFirstLeafParameter returns the first leaf parameter in a program. The combination of cgGetFirstLeafParameter and cgGetNextLeafParameter allow the iteration through all of the parameters of basic data types (not structs or arrays) without recursion. See cgGetNextLeafParameter for more information.

> ## Examples

>     CGparameter leaf = cgGetFirstLeafParameter( program );
>     while ( leaf )
>     {
>       /* Do stuff with leaf */
>       leaf = cgGetNextLeafParameter( leaf );
>     }

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

> cgGetFirstLeafParameter was introduced in Cg 1.1.

> ## See Also

> cgGetNextLeafParameter