/*
- * freeglut_main.c
+ * fg_main.c
*
* The windows message processing methods.
*
#include <GL/freeglut.h>
#include "fg_internal.h"
-#ifdef HAVE_ERRNO_H
-# include <errno.h>
-#endif
+#include <errno.h>
#include <stdarg.h>
-#ifdef HAVE_VFPRINTF
-# define VFPRINTF(s,f,a) vfprintf((s),(f),(a))
-#elif defined(HAVE__DOPRNT)
-# define VFPRINTF(s,f,a) _doprnt((f),(a),(s))
-#else
-# define VFPRINTF(s,f,a)
-#endif
/*
* Try to get the maximum value allowed for ints, falling back to the minimum
fprintf( stderr, "freeglut ");
if( fgState.ProgramName )
fprintf( stderr, "(%s): ", fgState.ProgramName );
- VFPRINTF( stderr, fmt, ap );
+ vfprintf( stderr, fmt, ap );
fprintf( stderr, "\n" );
va_end( ap );
fprintf( stderr, "freeglut ");
if( fgState.ProgramName )
fprintf( stderr, "(%s): ", fgState.ProgramName );
- VFPRINTF( stderr, fmt, ap );
+ vfprintf( stderr, fmt, ap );
fprintf( stderr, "\n" );
va_end( ap );
/* Perform work on the window (position, reshape, display, etc) */
fghProcessWork( );
+ /* Check OpenGL error state if requested.
+ * Don't call if no more open windows (can happen if user closes window from
+ * title bar), would lead to infinite error loop in glutReportErrors
+ */
+ if (fgState.GLDebugSwitch && fgStructure.CurrentWindow)
+ glutReportErrors( );
+
fgCloseWindows( );
}