[HOpenGL] Re: Exiting gracefully from (H)GLUT?

C.Reinke C.Reinke@ukc.ac.uk
Thu, 11 Apr 2002 19:43:45 +0100


> I have recently started using the HOpenGL (version 1.01) under Linux
> running ghc 5.02.1 and have a question. How do I exit my application
> gracefully (apart from closing the window). 
> In your examples you use 
> 
> > exitWith ExitSuccess
> 
> That however causes a:
> 
> TestGLUT: fatal error: GLUT_CBWindow_d7Tf: uncaught exception

Not sure whether that may help anyone in debugging,
but I didn't use to have this problem until today,
so today's changes might be related to the problem:

I used to supply the window callback via createWindow,
until I naively tried to create a DisplayList, to be
passed to the window callback. After wondering just
why genLists returned an empty list, I found that I
had to move the call to genLists after createWindow.

That meant I had to supply an empty window callback
to createWindow (return ()), then allocate and fill
my DisplayList, and finally register the proper window 
callback, with displayFunc.

Now I also get the error on termination:

e:\home\Haskell\hopengl\Tst.exe: fatal error: GLUT_CBWindow_d7TT: uncaught exception

The sources mention that it is illegal to unregister a
window callback -  is registering a new one a problem?

Claus


PS. I had to twiddle my configuration slightly, to get
    HOpenGL (great stuff, Sven, btw;) compiled. From the 
    archive, I gather that those missing commas are
    greencard-related and well-known, though.

config:

  Win2k
  Cygwin (recent)
  GHC-5.02.2 (msi)
  GreenCard 2.03 (msi)
  HOpenGL-1.01

problems:

  figuring out how to escape the space in the GreenCard-path:-)
  --with-green-card="c:/Program\\ Files\GreenCard\green-card.exe"

  spaces in some .gc files would cause make depend to fail:-(
    GLUT_State.gc:217
    GLUT_Init.gc:76
    GLUT_CBWindow.gc:287
  adding commas seems to have solved the issue