Re: [Haskell-cafe] Exiting GLUT application

2007-08-02 Thread Paul L
Are you trying it on Linux?

I had exactly the same problem. I believe it's with with X11/OpenGL.
I've written C programs using GLUT, freeGLUT and GLFW (another OpenGL
Window Kit) to re-open window after first one is closed. Unfortunately
all gave the same fault. So it leads me to believe the problem is not
really GLUT specific. I've not tried other platforms.

So I ended up using a trick that always keeps the first window and
reuse it for GHCi session. Just hide it and show it would make no
difference to the end user, at least true on both Windows and Linux.
Mac now has a problem prevents getting GLUT event when loaded in GHCi.

Regards,
Paul Liu

On 8/1/07, Dave Tapley [EMAIL PROTECTED] wrote:
 Unfortunately whilst the new code is returning me to a 'Main ' prompt
 as required another problem has come up.

 The issue here is found when the code is executed in both GHCi (6.6)
 and hugs (20050308).
 Once the code below is loaded evaluating main opens an unfilled window
 as required.

 However if this window is closed and main is evaluated again both GHCi
 and hugs die thus:

 GHCi: Illegal instruction (core dumped)
 hugs: Unexpected signal

 Any thoughts?


 On 31/07/07, Dave Tapley [EMAIL PROTECTED] wrote:
  Excellent, thank you Marc your advice worked perfectly.
 
  For reference the corrected code reads:
 
   import Graphics.UI.GLUT
   main = do
   getArgsAndInitialize
   createWindow 
   actionOnWindowClose $= ContinueExectuion
   mainLoop
 
  Dave,
 
 
  On 31/07/07, Marc A. Ziegert [EMAIL PROTECTED] wrote:
   in old glut, the main loop was the core of the single threaded program. 
   exiting it did mean to exit the program completely.
   in freeglut, you have alternatives. but for compatibility, it defaults to 
   the old behaviour.
  
   http://haskell.org/ghc/docs/latest/html/libraries/GLUT/Graphics-UI-GLUT-Begin.html#v%3AExit
  
   - marc
  
  
   Am Dienstag, 31. Juli 2007 19:16 schrieb Dave Tapley:
Hi everyone, I have the following skeleton GLUT code:
   
 import Graphics.UI.GLUT
 main = do
 getArgsAndInitialize
 createWindow 
 mainLoop
   
It loads into both hugs and ghci fine and when 'main' is evaluated an
empty window opens as expected.
However when closing the window (clicking the window manager's x
button) both hugs and ghci exit with the window, as opposed to
returning to the the 'Main' prompt.
   
I suspect I need some callback to exit the GUI cleanly?
   
Cheers,
Dave
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe
   
  
  
 
 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Exiting GLUT application

2007-08-01 Thread Dave Tapley
Unfortunately whilst the new code is returning me to a 'Main ' prompt
as required another problem has come up.

The issue here is found when the code is executed in both GHCi (6.6)
and hugs (20050308).
Once the code below is loaded evaluating main opens an unfilled window
as required.

However if this window is closed and main is evaluated again both GHCi
and hugs die thus:

GHCi: Illegal instruction (core dumped)
hugs: Unexpected signal

Any thoughts?


On 31/07/07, Dave Tapley [EMAIL PROTECTED] wrote:
 Excellent, thank you Marc your advice worked perfectly.

 For reference the corrected code reads:

  import Graphics.UI.GLUT
  main = do
  getArgsAndInitialize
  createWindow 
  actionOnWindowClose $= ContinueExectuion
  mainLoop

 Dave,


 On 31/07/07, Marc A. Ziegert [EMAIL PROTECTED] wrote:
  in old glut, the main loop was the core of the single threaded program. 
  exiting it did mean to exit the program completely.
  in freeglut, you have alternatives. but for compatibility, it defaults to 
  the old behaviour.
 
  http://haskell.org/ghc/docs/latest/html/libraries/GLUT/Graphics-UI-GLUT-Begin.html#v%3AExit
 
  - marc
 
 
  Am Dienstag, 31. Juli 2007 19:16 schrieb Dave Tapley:
   Hi everyone, I have the following skeleton GLUT code:
  
import Graphics.UI.GLUT
main = do
getArgsAndInitialize
createWindow 
mainLoop
  
   It loads into both hugs and ghci fine and when 'main' is evaluated an
   empty window opens as expected.
   However when closing the window (clicking the window manager's x
   button) both hugs and ghci exit with the window, as opposed to
   returning to the the 'Main' prompt.
  
   I suspect I need some callback to exit the GUI cleanly?
  
   Cheers,
   Dave
   ___
   Haskell-Cafe mailing list
   Haskell-Cafe@haskell.org
   http://www.haskell.org/mailman/listinfo/haskell-cafe
  
 
 

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Exiting GLUT application

2007-07-31 Thread Marc A. Ziegert
in old glut, the main loop was the core of the single threaded program. exiting 
it did mean to exit the program completely.
in freeglut, you have alternatives. but for compatibility, it defaults to the 
old behaviour.

http://haskell.org/ghc/docs/latest/html/libraries/GLUT/Graphics-UI-GLUT-Begin.html#v%3AExit

- marc


Am Dienstag, 31. Juli 2007 19:16 schrieb Dave Tapley:
 Hi everyone, I have the following skeleton GLUT code:
 
  import Graphics.UI.GLUT
  main = do
  getArgsAndInitialize
  createWindow 
  mainLoop
 
 It loads into both hugs and ghci fine and when 'main' is evaluated an
 empty window opens as expected.
 However when closing the window (clicking the window manager's x
 button) both hugs and ghci exit with the window, as opposed to
 returning to the the 'Main' prompt.
 
 I suspect I need some callback to exit the GUI cleanly?
 
 Cheers,
 Dave
 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe
 


pgplzVStD22ul.pgp
Description: PGP signature
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe