šŸ˜•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.