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