Terminating GLUT/GLFW programs

L.S., I am trying GLUT and GLFW (on Windows XP, with GHC 6.8.2); the sample programs do not terminate when I close the window by clicking on the cross in the upper right corner of the window. The sample program for GLUT is at http://blog.mikael.johanssons.org/archive/2006/09/opengl-programming-in-hask... the GLFW program: http://haskell.org/haskellwiki/GLFW I tried in the GLUT program: close = exitWith ExitSuccess closeCallback $= Just close -- => User error (unknown GLUT call getCloseFunc, check for freeglut) this needs freeglut (not documented); I downloaded freeglut.dll and placed it in the windows\system32 directory. The error message remained. What is needed to let these programs terminate properly? -- Met vriendelijke groet, Henk-Jan van Tuyl -- http://functor.bamikanarie.com http://Van.Tuyl.eu/ --

Hi, I had a similar (unsolved) problem with GLUT but on my system (Windows XP + GHC 6.8.2) GLFW works fine, exiting is no problem at all. But when building GLFW, make sure that the GHC gcc-lib directory comes *before* the MinGW/Cygwin directory in your PATH environment variable, since when linking, the LD.EXE bundled with GHC *must* be used. Cheers, Peter hjgtuyl@chello.nl wrote:
L.S.,
I am trying GLUT and GLFW (on Windows XP, with GHC 6.8.2); the sample programs do not terminate when I close the window by clicking on the cross in the upper right corner of the window.
The sample program for GLUT is at
http://blog.mikael.johanssons.org/archive/2006/09/opengl-programming-in-hask...
the GLFW program: http://haskell.org/haskellwiki/GLFW
I tried in the GLUT program: close = exitWith ExitSuccess
closeCallback $= Just close -- => User error (unknown GLUT call getCloseFunc, check for freeglut)
this needs freeglut (not documented); I downloaded freeglut.dll and placed it in the windows\system32 directory. The error message remained.
What is needed to let these programs terminate properly?

Thanks for the info, but it doesn't solve my problem; I adjusted the path,
reinstalled GLFW and recompiled the program, but it still does not
terminate.
Henk-Jan
On Mon, 24 Mar 2008 08:58:05 +0100, Peter Verswyvelen
Hi,
I had a similar (unsolved) problem with GLUT but on my system (Windows XP + GHC 6.8.2) GLFW works fine, exiting is no problem at all.
But when building GLFW, make sure that the GHC gcc-lib directory comes *before* the MinGW/Cygwin directory in your PATH environment variable, since when linking, the LD.EXE bundled with GHC *must* be used.
Cheers, Peter
hjgtuyl@chello.nl wrote:
L.S.,
I am trying GLUT and GLFW (on Windows XP, with GHC 6.8.2); the sample programs do not terminate when I close the window by clicking on the cross in the upper right corner of the window.
The sample program for GLUT is at
http://blog.mikael.johanssons.org/archive/2006/09/opengl-programming-in-hask... the GLFW program: http://haskell.org/haskellwiki/GLFW
I tried in the GLUT program: close = exitWith ExitSuccess
closeCallback $= Just close -- => User error (unknown GLUT call getCloseFunc, check for freeglut)
this needs freeglut (not documented); I downloaded freeglut.dll and placed it in the windows\system32 directory. The error message remained.
What is needed to let these programs terminate properly?

Indeed, the sample from the website does not close correctly when the window is closed; you must press the escape key. This problem has nothing to do with GLFW or the Haskell wrapper, but with the demo, which does not check if the window gets closed. I modified the example code on the wiki so it also exits when the window is closed (the original author might want to check my hack, it's not really clean). Of course this is all rather horrible imperative code :) For nicer alternatives, look at Yampa (the Space Invaders game or the Frag 3D shooter), or Reactive (which I don't understand yet ;-) and other functional reactive programming approaches .
-----Original Message----- From: hjgtuyl@chello.nl [mailto:hjgtuyl@chello.nl] Sent: dinsdag 25 maart 2008 0:45 To: bf3@telenet.be Cc: haskell-cafe@haskell.org Subject: Re: [Haskell-cafe] Terminating GLUT/GLFW programs
Thanks for the info, but it doesn't solve my problem; I adjusted the path, reinstalled GLFW and recompiled the program, but it still does not terminate.
Henk-Jan
On Mon, 24 Mar 2008 08:58:05 +0100, Peter Verswyvelen
wrote: Hi,
I had a similar (unsolved) problem with GLUT but on my system (Windows XP + GHC 6.8.2) GLFW works fine, exiting is no problem at all.
But when building GLFW, make sure that the GHC gcc-lib directory comes *before* the MinGW/Cygwin directory in your PATH environment variable, since when linking, the LD.EXE bundled with GHC *must* be used.
Cheers, Peter
hjgtuyl@chello.nl wrote:
L.S.,
I am trying GLUT and GLFW (on Windows XP, with GHC 6.8.2); the
programs do not terminate when I close the window by clicking on the cross in the upper right corner of the window.
The sample program for GLUT is at
sample programming-in-haskell-a-tutorial-part-1/
the GLFW program: http://haskell.org/haskellwiki/GLFW
I tried in the GLUT program: close = exitWith ExitSuccess
closeCallback $= Just close -- => User error (unknown GLUT call getCloseFunc, check for freeglut)
this needs freeglut (not documented); I downloaded freeglut.dll and placed it in the windows\system32 directory. The error message remained.
What is needed to let these programs terminate properly?

Peter is right at saying it's the sample GLFW program that didn't handle Window Close event. I didn't double check his modification because I run Linux/X11 with xmonad where there is no CLOSE button for any window, but I trust his modification works fine :-) As for the alternatives, I don't think there is a "nicer" model for general purpose GUI programming in functional style just yet. Yampa is nice in its treatment of continuous signals, but its event handling isn't any better. Sticking to plain-old imperative style with callbacks probably makes most practical sense. -- Regards, Paul Liu Yale Haskell Group http://www.haskell.org/yale

On Tue, Mar 25, 2008 at 7:37 PM, Paul L
Peter is right at saying it's the sample GLFW program that didn't handle Window Close event. I didn't double check his modification because I run Linux/X11 with xmonad where there is no CLOSE button for any window, but I trust his modification works fine :-)
Sure there is. The button is just on the keyboard (Ctrl-Shift-C) Luke

Er, not Ctrl, of course... Mod-Shift-C. /me goes to punish his hand
for compusive "send" presses.
On Tue, Mar 25, 2008 at 10:40 PM, Luke Palmer
On Tue, Mar 25, 2008 at 7:37 PM, Paul L
wrote: Peter is right at saying it's the sample GLFW program that didn't handle Window Close event. I didn't double check his modification because I run Linux/X11 with xmonad where there is no CLOSE button for any window, but I trust his modification works fine :-)
Sure there is. The button is just on the keyboard (Ctrl-Shift-C)
Luke

On 3/25/08, Luke Palmer
Er, not Ctrl, of course... Mod-Shift-C. /me goes to punish his hand for compusive "send" presses.
I believe that is to kill a window rather than a normal window close. -- Regards, Paul Liu Yale Haskell Group http://www.haskell.org/yale
participants (4)
-
hjgtuyl@chello.nl
-
Luke Palmer
-
Paul L
-
Peter Verswyvelen