PDA

View Full Version : GLUT - On exit code



Zocleus
08-23-2000, 12:54 PM
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.

cire
08-23-2000, 01: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.

MikeC
08-24-2000, 02: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.

Zocleus
08-24-2000, 06: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