Cg Core Runtime API cgCreateProgram(3)
NAME
cgCreateProgram - create a program object from a string
SYNOPSIS
#include
CGprogram cgCreateProgram( CGcontext context,
CGenum programtype,
const char * program,
CGprofile profile,
const char * entry,
const char ** args );
PARAMETERS
context The context to which the new program will be added.
programtype
An enumerant describing the contents of the program
string. The following enumerants are allowed:
CGSOURCE
program contains Cg source code.
CGOBJECT
program contains object code that resulted from
the precompilation of some Cg source code.
program A string containing either the programs source or
object code. See programtype for more information.
profile The profile enumerant for the program.
entry The entry point to the program in the Cg source. If
NUL, the entry point defaults to "main".
args If args is not NUL it is assumed to be an array of
NUL-terminated strings that will be passed directly
to the compiler as arguments. The last value of the
array must be a NUL.
RETURN VALUES
Returns a CGprogram handle on success.
Returns NUL if an error occurs.
DESCRIPTION
cgCreateProgram generates a new CGprogram object and adds it
to the specified Cg context.
EXAMPLES
Cg Toolkit 2.1 Last change: 1
Cg Core Runtime API cgCreateProgram(3)
CGcontext context = cgCreateContext();
CGprogram program = cgCreateProgram(context,
CGSOURCE,
mysourcestring,
CGPROFILEARBVP1,
"myshader",
NUL);
ERORS
CGINVALIDCONTEXTHANDLEROR is generated if context is
not a valid context.
CGINVALIDENUMERANTEROR is generated if programtype is
not CGSOURCE or CGOBJECT.
CGUNKNOWNPROFILEROR is generated if profile is not a
supported profile.
CGCOMPILEREROR is generated if compilation fails.
HISTORY
cgCreateProgram was introduced in Cg 1.1.
SEE ALSO
cgCreateContext, cgCreateProgramFromFile, cgDestroyProgram,
cgGetProgramString
Cg Toolkit 2.1 Last change: 2
|