NAME

cgCreateEffect - create an effect object from a source string

SYNOPSIS

  #include <Cg/cg.h>

  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 NULL it is assumed to be an array of NULL-terminated strings that will be passed directly to the compiler as arguments. The last value of the array must be a NULL.

RETURN VALUES

Returns a CGeffect handle on success.

Returns NULL if any error occurs. cgGetLastListing can be called to retrieve any warning or error messages from the compilation process.

DESCRIPTION

cgCreateEffect generates a new CGeffect object and adds it to the specified Cg context.

EXAMPLES

The following is a typical sequence of commands for initializing a new effect:

   char *effectSource = ...;
   CGcontext context = cgCreateContext();
   CGeffect effect  = cgCreateEffect(context,
                                     effectSource,
                                     NULL);

ERRORS

CG_INVALID_CONTEXT_HANDLE_ERROR is generated if the context is not a valid context.

CG_COMPILER_ERROR is generated if the compile failed.

HISTORY

cgCreateEffect was introduced in Cg 1.4.

SEE ALSO

cgCreateContext, cgCreateEffectFromFile, cgGetLastListing