NAME

cgGetNextProgram - iterate through programs in a context

SYNOPSIS

  #include <Cg/cg.h>

  CGprogram cgGetNextProgram( CGprogram prog );

PARAMETERS

prog

Specifies the program.

DESCRIPTION

The programs within a context can be iterated over by using the cgGetNextProgram function. The following example code illustrates one way to do this:

  CGprogram prog = cgGetFirstProgram( ctx );
  while( prog )
  {
   /* do something with prog */
   prog = cgGetNextProgram( prog )
  }

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.

RETURN VALUES

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

ERRORS

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

SEE ALSO

cgGetNextProgram, cgCreateProgram, cgDestroyProgram, and cgIsProgram