View Full Version : GLUT - On exit code

08-23-2000, 11:54 AM
Where do we put code we want to run when the app exits ? glutMainLoop( ) never returns so we can't put it after. I've checked the Callback funtions, the states, etc. But didn't find anything.

08-23-2000, 12:48 PM
To my knowledge, there isn't a way to execute code after glutMainLoop. There aren't callbacks, either.

Definitely a disadvantage of using GLUT.

08-24-2000, 01:02 AM
The ANSI C atexit() function can be used to set a callback if you're quitting with exit(). Not sure if it's respected by Win32 (e.g. whether it's called when you close a GLUT window by clicking the close box in the menubar) but you could give it a try.

08-24-2000, 05:53 AM
The atexit() function worked fine ! It even detects the close window icon ! Thanks for the help !!! http://www.opengl.org/discussion_boards/ubb/smile.gif