I think there is no other possibility than to call exit because the documentation says that glutMainLoop() never returns.
I suppose that it has a while(1) loop which can’t be left.
If you take a look at the GLUT source, you can see that there is no way out of the loop entered in glutMainLoop. If you manage to send something that close the window, you’re not going to get out of glutMainLoop.
I doubt this is a mistake, since GLUT have been around for quite some time, even before the development of it stopped a few years ago, and is used quite alot. I would guess that there was no real reason for it, since you’re not supposed to use GLUT for anything but smaller demos and similar stuff anyways.
What is it exactly you want to do after exiting the main loop? Are you really sure it’s something that can’t be done right before calling exit() to exit the program or something?
Well, i wouldn´t use GLUT if i wasn´t forced to use it. That´s why i do use it.
Actually, i wanted to do some clean up after the main-loop. But well, if it´s not possible to exit the main-loop, i will have to do the clean up somewhere else.
I still think it is a poor decision, not to include something to properly exit that loop. exit() looks pretty much like a brute-force thing, i thought there might be a more elegant way.