+static void
+Warning(const char *fmt, va_list ap)
+{
+ printf("%6d Warning callback:\n");
+
+ /* print warning message */
+ vprintf(fmt, ap);
+}
+
+static void
+Error(const char *fmt, va_list ap)
+{
+#define STRING_LENGTH 10
+ char dummy_string[STRING_LENGTH];
+ printf("%6d Error callback:\n");
+
+ /* print warning message */
+ vprintf(fmt, ap);
+
+ /* deInitialize the freeglut state */
+ /* This all goes haywire of course when the error occurs during deinitialize,
+ * one might want to call exit directly as its possible freeglut is messed
+ * up internally when error is called.
+ */
+ printf("Error callback: calling glutExit() to prepare for clean exit\n");
+ glutExit();
+
+ /* terminate program */
+ printf ( "Please enter something to exit: " );
+ fgets ( dummy_string, STRING_LENGTH, stdin );
+
+ exit(1);
+}
+