Name
cgGetProgramString - get strings from a program object
Synopsis
#include <Cg/cg.h>
const char * cgGetProgramString( CGprogram program,
CGenum enum );
Parameters
- program
-
The program to query.
- enum
-
Specifies the string to retrieve. enum can be one
of CG_PROGRAM_SOURCE, CG_PROGRAM_ENTRY, CG_PROGRAM_PROFILE,
or CG_COMPILED_PROGRAM.
Return Values
Returns a null-terminated string based on the value of enum.
Returns an empty string if an error occurs.
Description
cgGetProgramString allows the application to retrieve
program strings that have been set via functions that
modify program state.
When enum is CG_PROGRAM_SOURCE the original Cg
source program is returned.
When enum is CG_PROGRAM_ENTRY the main entry
point for the program is returned.
When enum is CG_PROGRAM_PROFILE the profile
for the program is returned.
When enum is CG_COMPILED_PROGRAM the string for
the compiled program is returned.
Examples
CGcontext context = cgCreateContext();
CGprogram program = cgCreateProgramFromFile(context,
CG_SOURCE,
mysourcefilename,
CG_PROFILE_ARBVP1,
"myshader",
NULL);
if(cgIsProgramCompiled(program))
printf("%s\n", cgGetProgramString(program, CG_COMPILED_PROGRAM));
Errors
CG_INVALID_PROGRAM_HANDLE_ERROR is generated if program
is not a valid program handle.
CG_INVALID_ENUMERANT_ERROR is generated if enum is not
CG_PROGRAM_SOURCE, CG_PROGRAM_ENTRY, CG_PROGRAM_PROFILE,
or CG_COMPILED_PROGRAM.
History
cgGetProgramString was introduced in Cg 1.1.
See Also
cgCreateProgram,
cgGetProgramOptions
|