2 * ------------------------------------------
5 * This is a sample program showing a basic
6 * user defined error handlers with FreeGLUT
7 * ------------------------------------------
10 #include <GL/freeglut.h>
13 * ------------------------------------------
14 * Declare our own Error handler for FreeGLUT
15 * ------------------------------------------
18 /* This declares the vprintf() routine */
21 /* This declares the va_list type */
24 /* The new handler looks like a vprintf prototype */
25 void myError (const char *fmt, va_list ap)
27 fprintf(stderr, "myError: Entering user defined error handler\n");
29 /* print warning message */
30 fprintf(stderr, "myError:");
31 vfprintf(stderr, fmt, ap);
32 fprintf(stderr, "\n");
34 /* deInitialize the freeglut state */
35 fprintf(stderr, "myError: Calling glutExit()\n");
38 /* terminate error handler appropriately */
39 fprintf(stderr, "myError: Exit-ing handler routine\n");
45 * ------------------------------------------
46 * Just enough code to create the error to
47 * demonstrate the user defined handler
48 * ------------------------------------------
50 int main(int argc, char** argv)
52 glutInitErrorFunc(&myError);
53 glutCreateWindow ("error test"); /* This is an error! */
54 glutInit(&argc, argv); /* Should be called