diff --git a/src/video/glvideo.c b/src/video/glvideo.c index 070b676c..cae9bb73 100644 --- a/src/video/glvideo.c +++ b/src/video/glvideo.c @@ -628,8 +628,14 @@ static void _gldriver_shutdown(void) { static void gldriver_shutdown(void) { #if USE_GLUT glutLeaveMainLoop(); -#endif +#else +# if MOBILE_DEVICE + // it could be a temporary backgrounding do nothing here ... + _gldriver_shutdown(); +# else emulator_shutting_down = true; +# endif +#endif } //---------------------------------------------------------------------------- @@ -667,13 +673,6 @@ static void gldriver_render(void) { return; } -#if MOBILE_DEVICE - if (UNLIKELY(emulator_shutting_down)) { - _gldriver_shutdown(); - return; - } -#endif - glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); #if MOBILE_DEVICE glViewport(viewportX, adjustedHeight, viewportWidth, viewportHeight); @@ -884,6 +883,7 @@ static void gldriver_main_loop(void) { glutSetOption(GLUT_ACTION_ON_WINDOW_CLOSE, GLUT_ACTION_GLUTMAINLOOP_RETURNS); glutMainLoop(); LOG("GLUT main loop finished..."); + emulator_shutting_down = true; _gldriver_shutdown(); #endif // fall through if not GLUT