PDA

View Full Version : :confused:Glut and window close.



paddy
09-25-2000, 08:28 AM
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 !

Bob
09-25-2000, 11:24 AM
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.

Zocleus
09-25-2000, 11:29 AM
I've used atexit() and it worked fine. Did you set it in your main before calling glutMainLoop() ?

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

paddy
09-26-2000, 03:59 AM
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 http://www.opengl.org/discussion_boards/ubb/frown.gif

Thanks for you help anyway.