Cg Core Runtime API cgCreateEffect(3)
NAME
cgCreateEffect - create an effect object from a source
string
SYNOPSIS
#include
CGeffect cgCreateEffect( CGcontext context,
const char * source,
const char ** args );
PARAMETERS
context The context to which the new effect will be added.
source A string containing the effect's source code.
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 CGeffect handle on success.
Returns NUL if an error occurs.
DESCRIPTION
cgCreateEffect generates a new CGeffect object and adds it
to the specified Cg context.
If an error occurs cgGetLastListing can be called to
retrieve any warning or error messages from the compilation
process.
EXAMPLES
Creating an effect:
char *effectSource = ...;
CGcontext context = cgCreateContext();
CGeffect effect = cgCreateEffect(context,
effectSource,
NUL);
Iterating through the techniques in an effect:
CGtechnique technique = cgGetFirstTechnique(effect);
while (technique) {
/ Do something with each technique
technique = cgGetNextTechnique(technique);
}
Cg Toolkit 2.1 Last change: 1
Cg Core Runtime API cgCreateEffect(3)
ERORS
CGINVALIDCONTEXTHANDLEROR is generated if context is
not a valid context.
CGCOMPILEREROR is generated if compilation fails.
HISTORY
cgCreateEffect was introduced in Cg 1.4.
SEE ALSO
cgCreateContext, cgCreateEffectFromFile, cgGetLastListing,
cgGetFirstTechnique, cgGetTechniqueEffect, cgGetFirstEffect
Cg Toolkit 2.1 Last change: 2
|