glut and delete pointers

HI guys!! i have a prblem with glut here it is, y decare pointers and i alloc memory… but the destructor never exectute… when i exit the program i need something like onExit() … anyone get this problem in the past ??
txs in advance!

I think FreeGlut has a change to the main loop to allow a callback to your code. That lets you have a cleaner exit strategy than normal glut.

However, you could also just register a clean up function (or multiple) using atexit that does whatever your program needs to delete objects etc.

Glut isn’t being actively developed anymore, so I suggest you move to freeglut. It has a glutLeaveMainLoop call which allows you to clean up at exit.


ok thanks Nico for your tip, i solve it using an ANSI C funtion onexit() i will try freeglut

or you can try this glut patch that adds exit from mainloop and mouse wheel support