Ticket #8 (closed defect: fixed)

Opened 6 years ago

Last modified 6 years ago

FieldTrip depends on freeglut, won't work with other GLUT impls

Reported by: kballard Owned by: somebody
Priority: major Milestone:
Version: Keywords:
Cc: kazuya


FieldTrip uses the glutSetOption call which, while I'm assuming is available through freeglut, is not available through other GLUT implementations, including the one provided by OS X. FieldTrip should be more accepting of non-freeglut GLUT impls.

Change History

Changed 6 years ago by conal

Totally! I'm now trying to figure out a way to use glutLeaveMainLoop when freeglut is present and not when it isn't. I could use some help. I figure that the implementation has some way to generate that error message, and maybe we could similarly just do an Exit if freeglut is missing.

The great thing about glutLeaveMainLoop is that it allows reactive-glut and hence FieldTrip to play nicely with ghci. Closing a window returns to ghci for more fun.

Meanwhile, see FRP.Reactive.GLUT.SimpleGL in the reactive-glut package. Comment out the line

actionOnWindowClose $= MainLoopReturns

Changed 6 years ago by camio

I don't have enslaved-glut on my machine so I can't test it out. Is the error an error upon compilation? If it is a "normal" haskell error, it seems like it could be caught using exception handling.

Changed 6 years ago by kazuya

  • cc kazuya added

Changed 6 years ago by conal

Claus Reinke wrote:

Is this still an open issue in FieldTrip? If you look at the online versions of the files Sven mentioned



you can see how the dynamic lookup of functions that are only available in some extensions is handled. Looking at


it does seem as if constants and StateVars? are not directly protected like this, but 'actionOnWindowClose' calls 'glutSetOption', which you can see in


as just such a dynamic lookup. In case this isn't clear: your code can simply catch the exception thrown when that dynamic lookup fails, letting the exception handler pursue an alternative path (since your ticket recommends commenting out that line, the handler could perhaps just do nothing in your case, or issue a warning about missing freeglut?).

No change to the GLUT package should be needed, I think.


Changed 6 years ago by conal

Would someone with convenient access to a non-freeglut system be up for trying out Claus's suggestion?

Changed 6 years ago by conal

  • status changed from new to closed
  • resolution set to fixed

Using Claus's suggestion, ksf fixed the problem:

  catch (actionOnWindowClose $= MainLoopReturns)
        (const (return ()))

Changed 6 years ago by conal

thanks ksf (Achim Schneider)!

Note: See TracTickets for help on using tickets.