cgGetProgramString(3)

NAME
cgGetProgramString - get strings from a program object

SYNOPSIS
  #include <Cg/cg.h>
  const char * cgGetProgramString( CGprogram program,
                                   CGenum enum );

PARAMETERS
The program to query. 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
the cgCreateProgram manpage, the cgGetProgramOptions manpage