😕Glut and window close.

How the hell do i detect that the user has closed a window using the close box in windows GLUT ?
The program just exits, without even calling the atexit callback, and i have some stuff to free !

Sorry, there’s no exit handling in GLUT. Mainly because glutMainLoop is not supposed to end I guess.

And any unfreed memory, or unclosed files are (or at least SHOULD) be freed/closed by the operating system.

I’ve used atexit() and it worked fine. Did you set it in your main before calling glutMainLoop() ?

main()
{
//…
atexit(FreeMemory);
glutMainLoop();
}

Anyway this is NOT good !
Any c/c++ beginner would have added a “window close” callback !
GLUT SUCKS and i’m not gonna use it !
And that’s bad because the base idea of abstraction layer is great

Thanks for you help anyway.