NAME

cgGetNextProgram - iterate through programs in a context

SYNOPSIS

  #include <Cg/cg.h>

  CGprogram cgGetNextProgram( CGprogram program );

PARAMETERS

program

The current program.

RETURN VALUES

cgGetNextProgram returns the next program in the context's internal sequence of programs. Returns 0 when program is the last program in the context.

DESCRIPTION

The programs within a context can be iterated over by using the cgGetNextProgram function.

EXAMPLES

The following example code illustrates one way to do this:

  CGprogram program = cgGetFirstProgram( context );
  while( program )
  {
   /* do something with program */
   program = cgGetNextProgram( program )
  }

Note that no specific order of traversal is defined by this mechanism. The only guarantee is that each program will be visited exactly once. No guarantees can be made if programs are generated or deleted during iteration.

ERRORS

CG_INVALID_PROGRAM_HANDLE_ERROR is generated if program does not refer to a valid program.

HISTORY

cgGetNextProgram was introduced in Cg 1.1.

SEE ALSO

cgCreateProgram, cgDestroyProgram, cgIsProgram