Enter the GLUT event processing loop; it will call as necessary any callbacks that have been registered. This routine should be called at most once in a GLUT program.
(freeglut only) Process one iteration's worth of events in its event loop. This allows the application to control its own event loop and still use the GLUT package.
If the application has two nested calls to
mainLoop and calls
leaveMainLoop, the behaviour is undefined. It may leave only the inner
nested loop or it may leave both loops. If the reader has a strong preference
for one behaviour over the other he should contact the freeglut Programming
Consortium and ask for the code to be fixed.
Controlling the behaviour when windows are closed
The behaviour when the user closes a window.
Exit the whole program when any window is closed or
Return from mainLoop when any window is closed.
Return from mainLoop after the last window is closed.