GLUT32 and Watcom

For some reason I can’t reply to previous post on GLUT and Watcom, so here’s my separate post.

There are a few hacks in the Win32 version GLUT to make it behave more or less like the original X11 version, and some have to do with automatic context cleanup on exit.

It Win32 it has to be done with mechanism like ATEXIT hack, otherwise the main loop exit() call may not get all the way through to terminating the process. Refer to glut_event.c module for glutMainLoop waiting on quit message.

You should also look at the win32_proc.c module for WM_ message handling. There was one hack in GLUT 3.7 distribution that changed handling of close, destroy, and quit events just to suit NVidia’s drivers, and that should really be re-enabled for general case.

The combination of quit message hacks is what is responsible for default GLUT32 apps going zombie on window closes.

BTW, One other thing I learned with Watcom C in particular is that if you compile and link for WINDOWS subsystem instead of CONSOLE, you will automatically get GLUT window without text console attached. Kendall at SciTech discovered this as feature for automatically resolving main() and WinMain() entry points which Visual C was not able to do.