Cg Core Runtime API cgCreateObjFromFile(3)
NAME
cgCreateObjFromFile - create a cg object type from a shader
file
SYNOPSIS
#include
CGobj cgCreateObjFromFile( CGcontext context,
CGenum programtype,
const char * sourcefile,
CGprofile profile,
const char ** args );
PARAMETERS
context The context to which the new object will be added.
programtype
An enumerant describing the contents of the source
string. The following enumerants are allowed:
CGSOURCE
source contains Cg source code.
CGOBJECT
source contains object code that resulted from
the precompilation of some Cg source code.
sourcefile
Name of a file containing source or object code.
See programtype for more information.
profile The profile enumerant for the program.
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 CGobj handle on success.
Returns NUL if an error occurs.
DESCRIPTION
cgCreateObjFromFile creates a new CGobj which is a source
code object similar to a .obj or .o in C/C] programming
where various forms of data can be extracted. This can be
used, for example, to create user defined data types from a
Cg source string.
Cg Toolkit 2.1 Last change: 1
Cg Core Runtime API cgCreateObjFromFile(3)
EXAMPLES
/ To create a Cg obj:
CGcontext ctx = cgCreateContext();
CGobj structObj = cgCreateObjFromFile(ctx, CGSOURCE, sourcefile,
CGPROFILEARBVP1, NUL);
/ Now we can get the CGtype:
CGtype userDefinedMyType = cgGetNamedUserType(structObj, "MyType");
/ We could also iterate through all the types in the CGobj printing
/ their names like this:
int numTypes = cgGetNumUserTypes(structObj);
for (int i=0; i |