Name
cgGetProgramOutput - get the program's output
Synopsis
#include <Cg/cg.h>
CGenum cgGetProgramOutput( CGprogram program );
Parameters
- program
-
A program handle.
Return Values
Returns a program output enumerant. If the program is a vertex or fragment
program, it returns CG_VERTEX or CG_FRAGMENT, respectively. For geometry
programs the output is one of: CG_POINT_OUT, CG_LINE_OUT, or
CG_TRIANGLE_OUT. For tessellation control programs the output is CG_PATCH.
Returns CG_UNKNOWN if the output is unknown.
Description
cgGetProgramOutput returns the program output enumerant.
For geometry programs, an input must be specified but not an output
because of implicit output defaults. For example, if either "TRIANGLE"
or "TRIANGLE_ADJ" is specified as an input without an explicit output
in the shader source, then cgGetProgramOutput will return CG_TRIANGLE_OUT.
Examples
void printProgramOutput(CGprogram program)
{
char * output = NULL;
switch(cgGetProgramOutput(program))
{
case CG_VERTEX:
output = "vertex";
break;
case CG_FRAGMENT:
output = "fragment";
break;
case CG_POINT_OUT:
output = "point";
break;
case CG_LINE_OUT:
output = "line";
break;
case CG_TRIANGLE_OUT:
output = "triangle";
break;
case CG_PATCH:
output = "patch";
break;
default:
output = "unknown";
break;
}
printf("Program outputs %s.\n", output);
}
Errors
CG_INVALID_PROGRAM_HANDLE_ERROR is generated if program
is not a valid program handle.
History
cgGetProgramOutput was introduced in Cg 2.0.
See Also
cgGetProgramInput
|