NAME

cgCreateEffect - generate a new effect object from a file

SYNOPSIS

  #include <Cg/cg.h>

  CGeffect cgCreateEffect(CGcontext ctx, 
                          const char *filename,
                          const char **args)

PARAMETERS

ctx

Specifies the context that the new effect will be added to.

filename

A file name 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 as directly to the compiler as arguments. The last value of the array must be a NULL.

DESCRIPTION

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

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

   CGcontext ctx = cgCreateContext();
   CGeffect eff  = cgCreateEffectFromFile(ctx, "filename.cgfx", 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.

ERRORS

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

CG_FILE_READ_ERROR is generated if the given filename cannot be read.

CG_COMPILER_ERROR is generated if the compile failed.

SEE ALSO

cgCreateContext, cgCreateEffect, and cgGetLastListing