[HOpenGL] Exiting application

David Waern davve at dtek.chalmers.se
Tue Sep 7 14:30:25 EDT 2004


On Tue, Sep 07, 2004 at 06:26:11PM +0200, Sven Panne wrote:
> 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.
> 
> To be exact, it's the GLUT part of HOpenGL which misses the functionality 
> you
> want. But this is a direct consequence of the GLUT library, and there is 
> not much
> HOpenGL can do about it. 

When i used GLUT for visual c++ it atleast correctly exited the program
when i closed the window (and that is really the only thing i want to do). 
HOpenGL doesn't do this. I don't know much about GLUT so maybe you are 
still right in that this is GLUT's fault, but I just wanted to point this
out. 

> >Also, when I have the hopengl mainloop running and I destroy the current
> >window (or exit with System.Exit.exitWith), both ghci and hugs just dies
> >along with the app.
> 
> When you destroy the last window, GLUT exits the application internally, so 
> it's
> not a Haskell issue. Using exitWith exits ghci/hugs, that's what it is 
> supposed
> to do, isn't it? :-)

Is it? I don't get that behaviour with hugs/ghci with normal programs here 
(i.e the interpreter programs themselves aren't exited when i call exitWith).

The reason hugs/ghci go down in this case is probably because the exitWith 
call makes HOpenGL destroy the last window in response to the exitException 
that is thrown.

So the problem is really that the interpreters don't run the interpreted
programs in a separate process to protect the interpreter interfaces. 
Which makes it a "Haskell-tools" issue? :)

> No, not at all. GLUT is only meant as a simple UI library, if you want 
> something
> more polished, you can try gtk+hs 
> (http://www.cse.unsw.edu.au/~chak/haskell/gtk/)
> or wxHaskell (http://wxhaskell.sourceforge.net/). 

I'll definitely do that. I've wanted to try wxHaskell anyway for a school
project.

David


More information about the HOpenGL mailing list