Killing a window kills the prog

Hi – I’m just starting out with GLUT (tho I’ve been doing windows programs a while & C & C++ more years than I care to think). I have a GLUT program that puts up several windows (created with glutCreateWindow()). Each window has the usual decorations along the top & can be moved around independently, which’s what I want. However clicking the little “x” on the top right corner doesn’t just kill the window, it makes the whole program exit, rather abruptly, which isn’t what I want at all. Why? Is there any way to stop it? (I’d like clicking the “x” to kill the window & execute the destructor of its controlling class, but I’d like the program to carry on running.) I’m guessing it’s an event loop thing, maybe?

keep smiling



Get my code … if yo need to use glut …


chop off the “.html” from the URL and enter the directory with code.

I have added a glutWMCloseFunc( your_routine )
call …

This registers a callback function on a per window basis …

The default action is to do what glut does now