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

C.Reinke C.Reinke@ukc.ac.uk
Mon, 15 Apr 2002 15:09:24 +0100


> > C. Reinke wrote:
> >>[...] I found that I
> >>had to move the call to genLists after createWindow.
> >>
> > I'd expect that, because most (all?) versions of GLUT don't initialize the
> > OpenGL context until the window has actually been created. [...]
> 
> Exactly, I just had a look in the GLUT sources. So the general rule of thumb is:
> 
>     Issue OpenGL calls *after* the first createWindow, never before.

Isn't that an argument against the displayFunc parameter to HOpenGL's
createWindow? One could still have a createSimpleWindow or something
for simple applications, but why pass and install a null handler if
one most certainly needs to replace it soon?

> This makes sense perfectly: Remember that you could have multiple Windows,
> so the effect of e.g. setting the current to color depends on the current
> GLX/OpenGL context. The latter one is created with createWindow, changed
> with e.g. setWindow, overlay handling, etc. etc.

I was fooled by display lists - while their drawing commands aren't
executed until they are called, the implicit state queries that
determine how a vertex will appear when drawn are executed at
construction time:-( Hence they also suffer from the dependency 
you describe.

Btw, is this

  foreign import shutdownHaskellAndExit :: Int -> IO ()

going to be standard Haskell/FFI/xx ? The earlier discussion here
mentioned some hs_exit instead, but it wasn't clear whether that
would make it into the addendum, either. 

Ah, the FFI release candidate 3 mentions hs_exit in section 
"6.1 CForeign" - is that the way to go then?

Claus