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

> ## Name

> cgSetErrorCallback - set the error callback function

> ## Synopsis

>     #include <Cg/cg.h>

>     typedef void (*CGerrorCallbackFunc)( void );

>     void cgSetErrorCallback( CGerrorCallbackFunc func );

> ## Parameters

> func
>   A function pointer to the error callback function.

> ## Return Values

> None.

> ## Description

> cgSetErrorCallback sets a callback function that will be called every time an error occurrs. The callback function is not passed any parameters. It is assumed that the callback function will call cgGetError to obtain the current error. To disable the callback function, cgSetErrorCallback may be called with NULL.

> ## Examples

> The following is an example of how to set and use an error callback :

>     void MyErrorCallback( void ) {
>       int myError = cgGetError();
>       fprintf(stderr, "CG ERROR : %s\n", cgGetErrorString(myError));
>     }

>     void main(int argc, char *argv[])
>     {
>       cgSetErrorCallback(MyErrorCallback);

>       /* Do stuff */
>     }

> ## Errors

> None.

> ## History

> cgSetErrorCallback was introduced in Cg 1.1.

> ## See Also

> cgGetErrorCallback, cgGetError, cgGetErrorString