How to detect a glut close window event?

Hi.
Can someone tell me how to detect that a glut window is being closed so that i can process some commands before exiting. I have allocated memory dynamically to objects using new , which i want to deallocate before the program exits.

Thanks.

Hi

Get my new code (oldish now!)

read:
http://www-users.york.ac.uk/~rpf1/glut.html

chop off the “.html” to enter the directory with code.

There is a new glutWMCloseFunc( your_routine )
callback which will let you register a callback
as per the other callbacks which will be invoked when you close the window.

This works PER WINDOW too, so different windows can have different callbacks!

Enjoy

Rob