cgGetProgramDomainProgram(3)

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