cgCreateProgramFromEffect
Keywords: cgCreateProgramFromEffect, NVIDIA, NVIDIA Cg Toolkit, Cg Toolkit, Shader, Shader Programming, GPU Shader Programming, GPU Program

> ## Name

> cgCreateProgramFromEffect - create a program object from an effect

> ## Synopsis

>     #include <Cg/cg.h>

>     CGprogram cgCreateProgramFromEffect( CGeffect effect,
>                                          CGprofile profile,
>                                          const char * entry,
>                                          const char ** args );

> ## Parameters

> effect
>   The effect containing the program source code from which to create the program.
> profile
>   The profile enumerant for the program.
> entry
>   The entry point to the program in the Cg source. If NULL, the entry point defaults to "main".
> 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 CGprogram handle on success.

> Returns NULL if an error occurs.

> ## Description

> cgCreateProgramFromEffect generates a new CGprogram object and adds it to the effect's Cg context.

> ## Examples

> to-be-written

> ## Errors

> CG_INVALID_EFFECT_HANDLE_ERROR is generated if effect is not a valid effect.

> CG_UNKNOWN_PROFILE_ERROR is generated if profile is not a supported profile.

> CG_COMPILER_ERROR is generated if compilation fails.

> ## History

> cgCreateProgramFromEffect was introduced in Cg 1.4.

> ## See Also

> cgCreateProgram, cgCreateProgramFromFile