[HOpenGL] Exiting application

Glynn Clements glynn.clements at virgin.net
Tue Sep 7 13:10:27 EDT 2004


David Waern wrote:

> How are you supposed to handle the event of a user who closes the hopengl
> window? I see no way to detect this with the API. The main loop of hopengl
> just keeps running.

OpenGL doesn't deal with window management; that's handled by
whichever UI toolkit you are using. GLUT responds to window deletion
by either calling exit (X11):

      case ClientMessage:
        if (event.xclient.data.l[0] == __glutWMDeleteWindow)
          exit(0);
        break;

or PostQuitMessage() (Win32):

  case WM_CLOSE:
    PostQuitMessage(0);

If you want more control, you'll need to use something other than
GLUT, e.g. GTK+HS or wxHaskell.

-- 
Glynn Clements <glynn.clements at virgin.net>


More information about the HOpenGL mailing list