Problem with GLUT - no visuals found

So I'm running into an embarrassing problem trying to prepare for the computer programming class that I intend to 12-13 year olds in Haskell this coming fall. I had decided to use gloss, an excellent package by Ben Lippmeier that makes it really easy to build images, animations, simulations, and games in a straight-forward and functional way. Excellent... but suddenly broken on my system since installing Ubuntu 11.4, and it looks like the cause traces back to GLUT. Prelude Graphics.Gloss> displayInWindow "Test" (100,100) (100,100) white (Circle 80) freeglut (<interactive>): ERROR: Internal error <Visual with necessary capabilities not found> in function fgOpenWindow X Error of failed request: BadWindow (invalid Window parameter) Major opcode of failed request: 4 (X_DestroyWindow) Resource id in failed request: 0x0 Serial number of failed request: 25 Current serial number in output stream: 28 and Prelude Graphics.UI.GLUT> initialize "foo" [] [] Prelude Graphics.UI.GLUT> get displayModePossible False Nothing I can find to change in GLUT causes displayModePossible to be True, and I'm at the end of my knowledge here. A quick web search turns up the occasional person complaining about the freeglut error, but in all cases they have trouble running any GLUT applications, and it turns out their configuration doesn't do direct rendering. In my case, glxgears and any other non-Haskell GLUT applications I can find work great, but Haskell's GLUT bindings are giving me no hint of success. Any ideas? -- Chris Smith

It may be related to the problem which I encountered too: http://www.mail-archive.com/haskell-cafe@haskell.org/msg89460.html Try using GLUT from http://github.com/haskell-opengl/GLUT Hope that helps. --Artyom

On Thu, 2011-06-23 at 18:59 +0300, Artyom Kazak wrote:
It may be related to the problem which I encountered too: http://www.mail-archive.com/haskell-cafe@haskell.org/msg89460.html
Try using GLUT from http://github.com/haskell-opengl/GLUT
Thanks for the suggestions! However, it doesn't look like this is related to the Windows code page issue (I'm using Ubuntu 11.4), and just to be sure I've tried with the latest GLUT from git, and there is no change here. -- Chris Smith

Answering my own question, apparently GLUT only doesn't work from within GHCi. I also tried on Windows 7, and while I can run GLUT from GHCi on Windows 7, I can never get a command prompt back from Gloss's displayInWindow. So it looks like I'll just make sure we don't use gloss from GHCi, and things will be fine. I'm still waiting to test on a Mac; I know there'll be a lot of struggle to figure out the XCode thing, but I imagine it'll be doable. -- Chris Smith

On Thu, Jun 23, 2011 at 11:32 AM, Chris Smith
Answering my own question, apparently GLUT only doesn't work from within GHCi.
Most GUI bindings in Haskell do not work correctly from GHCI. I've been trying (with lots of help from others) to get the GLFW-b bindings to be solid on all platforms, even from GHCI. Currently, they build on all platforms and work from GHCI on Linux and Windows. OSX support is almost there, thanks to help from Raeez Lorgat on StackOverflow. On OSX, it now works in GHCI but the Setup.hs needs to be changed a bit before you can depend on it. I doubt I'll get to it this week but it's very close. What is your deadline for making sure you have a working library? Thanks, Jason

Oops, forgot to copy the list... here's what I sent to Jason: On Thu, 2011-06-23 at 11:50 -0700, Jason Dagit wrote:
What is your deadline for making sure you have a working library?
I don't know... August? In any case, I do now have a working library, so long as I remember not to use GHCi for it! While GLFW would certainly be far preferable to GLUT in the long run, the fact is that Gloss is already implemented using GLUT, and I can make GLUT work. So I'll plan on using that unless someone else volunteers to port Gloss to GLFW. (To be honest, I did consider it when I first ran into this problem a week ago; but after a few hours of hacking at it, it became clear that it's too large a job, and I'm far too unfamiliar with GLUT, GLFW, or OpenGL, for that to be feasible as yet another side project for me.) -- Chris Smith
participants (3)
-
Artyom Kazak
-
Chris Smith
-
Jason Dagit