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

> ## Name

> cgGetNamedEffect - get an effect from a context by name

> ## Synopsis

>     #include <Cg/cg.h>

>     CGeffect cgGetNamedEffect( CGcontext context,
>                                const char * name );

> ## Parameters

> context
>   The context from which to retrieve the effect.
> name
>   The name of the effect to retrieve.

> ## Return Values

> Returns the named effect if found.

> Returns NULL if context has no effect corresponding to name or if an error occurs.

> ## Description

> The effects in a context can be retrieved directly by name using cgGetNamedEffect. The effect names can be discovered by iterating through the context's effects (see cgGetFirstEffect and cgGetNextEffect) and calling cgGetEffectName for each.

> ## Examples

>     /* get "simpleEffect" from context */
>     CGeffect effect = cgGetNamedEffect( context, "simpleEffect" );

> ## Errors

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

> ## History

> cgGetNamedEffect was introduced in Cg 1.5.

> ## See Also

> cgGetEffectName, cgSetEffectName, cgGetFirstEffect, cgGetNextEffect