glutCloseFunc man page
glutCloseFunc — Window destruction callback.
OpenGLUT - windowcallback
glutCloseFunc(void( *callback )( void ));
Client window destruction hook.
When a window is destroyed by user-action in traditional GLUT, the application terminates. In freeglut and OpenGLUT, the application can choose to persist and treat the window close event as a normal event. This callback is how that event is transmitted to the application.
This callback is bound to the
This function is
the same as glutWMCloseFunc(), which has been deprecated. This function should be used instead.
There needs to be some work to rationalize the behavior when a window is closed.