> ## Name

> cgGetProgramDomainProgram - get an indexed domain program of a combined program

> ## Synopsis

>     #include <Cg/cg.h>

>     CGprogram cgGetProgramDomainProgram( CGprogram program,
>                                          int index );

> ## Parameters

> program
>   The handle of the combined program object.
> index
>   The index of the program's domain program to be queried.

> ## Return Values

> Returns the program handle for the program with the given domain index.

> Returns 0 if an error occurs.

> ## Description

> A combined program consists of multiple domain programs. For example, a combined program may contain a vertex domain program and a fragment domain program. cgGetProgramDomainProgram gets the indexed domain program of the specified combined program.

> If the program parameter is not a combined program and the index is zero, program handle is simply returned as-is without error.

> ## Examples

>     /* This will enable all profiles for each domain in glslComboProgram */
>     int domains = cgGetNumProgramDomains(glslComboProgram);
>     for (int i=0; i<domains; i++) {
>       CGprogram subprog = cgGetProgramDomainProgram(glslComboProgram, i);
>       CGparameter param = cgGetFirstParameter(subprog);
>       while (param) {
>         // Do something to each parameter of each domain program
>         param = cgGetNextParameter(param);
>       }
>     }

> ## Errors

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

> CG_INVALID_PARAMETER_ERROR is generated if index is less than 0 or greater than or equal to the number of domains in program.

> ## History

> cgGetProgramDomainProgram was introduced in Cg 2.1.

> ## See Also

> cgGetNumProgramDomains, cgGetProfileDomain, cgGetProgramDomainProfile