From e8d8bdf9e328fa2c7f1b2d2bb0739b2e744f9e7e Mon Sep 17 00:00:00 2001 From: dcnieho Date: Wed, 22 Jan 2014 10:09:57 +0000 Subject: [PATCH] implement handling of GLDebugSwitch: we use glutReportErrors to check for errors in each iteration of the glut mainloop if requested git-svn-id: https://svn.code.sf.net/p/freeglut/code/trunk@1641 7f0cb862-5218-0410-a997-914c9d46530a --- freeglut/freeglut/src/fg_main.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/freeglut/freeglut/src/fg_main.c b/freeglut/freeglut/src/fg_main.c index d17801c..f409b33 100644 --- a/freeglut/freeglut/src/fg_main.c +++ b/freeglut/freeglut/src/fg_main.c @@ -465,6 +465,13 @@ void FGAPIENTRY glutMainLoopEvent( void ) /* 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( ); }