> ## Name

> cgCreateEffectFromFile - create an effect object from a file

> ## Synopsis

>     #include <Cg/cg.h>

>     CGeffect cgCreateEffectFromFile( CGcontext context,
>                                      const char * filename,
>                                      const char ** args );

> ## Parameters

> context
>   The context to which the new effect will be added.
> filename
>   Name of a file that contains 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 an error occurs.

> ## Description

> cgCreateEffectFromFile 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

>     CGcontext context = cgCreateContext();
>     CGeffect effect = cgCreateEffectFromFile(context, "filename.cgfx", NULL);

> ## Errors

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

> CG_FILE_READ_ERROR is generated if the given filename cannot be read.

> CG_COMPILER_ERROR is generated if compilation fails.

> ## History

> cgCreateEffectFromFile was introduced in Cg 1.4.

> ## See Also

> cgCreateContext, cgCreateEffect, cgGetLastListing, cgGetTechniqueEffect, cgGetEffectName, cgSetEffectName, cgCreateEffectAnnotation, cgDestroyEffect, cgGetFirstEffect