Example Program and Compiliation?

Hi all, I recently downloaded the new version of HOpenGL (1.05) and ghc(6.0.1), compiled them, set them up without any problems. Now I'm trying to strech my wings a little by doing some intial programs. Unfortunately there isn't any recent tutorials, and I know that HOpenGL has gone through some interface name changes. I was hoping that maybe somebody on the list could give me an short example program, or atleast how to run ghc to compile the Hello.hs program found in the examples/redbook_hs directory, outside of running the makefile (ie, what would be the command I would run to compile it, what packages etc.) I am currently working on a linux system, but if you only know windows, I can probably translate between the two. Thank you for your time, and if you just find this annoying, delete it. Peace. -E. Zeltmann

"Eric L. Zeltmann"
Hi all,
I recently downloaded the new version of HOpenGL (1.05) and ghc(6.0.1), compiled them, set them up without any problems.
Now I'm trying to strech my wings a little by doing some intial programs. Unfortunately there isn't any recent tutorials, and I know that HOpenGL has gone through some interface name changes. I was hoping that maybe somebody on the list could give me an short example program, or atleast how to run ghc to compile the Hello.hs program found in the examples/redbook_hs directory, outside of running the makefile (ie, what would be the command I would run to compile it, what packages etc.)
I am currently working on a linux system, but if you only know windows, I can probably translate between the two.
Thank you for your time, and if you just find this annoying, delete it.
I'm still not sure whether OpenGL or HOpenGL is the canonically correct version, but the ghc6-hopengl debian package maintainer (Ian Lynagh) wrote this cute demo script that works with the HOpenGL debs he created: -- Shae Erisson If anyone lets loose with the secret that hearing a request doesn't force one to obey it, sue 'em under the DMCA. After that, anyone who doesn't obey you is obviously using a circumvention device (their brain), which you can have confiscated by the authorities. -- Baron_Yam on slashdot.org

Shae Matijs Erisson wrote:
I'm still not sure whether OpenGL or HOpenGL is the canonically correct version
Long story made short: The HOpenGL tar files on http://haskell.org/HOpenGL are the predecessors to the "OpenGL" and "GLUT" packages in the GHC CVS repository at http://cvs.haskell.org/cgi-bin/cvsweb.cgi/fptools/libraries/. The tar files are essentially unsupported now and the API has changed a bit since then. The version in the repository is actively maintained, and GHC and Hugs (probably NHC98, too) can easily be built with OpenGL/GLUT support via a single "--enable-hopengl" configure option. It is up to the maintainers of the binary distributions if there is OpenGL/GLUT support or not. If you are using Windoze, the recent Hugs installer would be a good choice, it includes both packages. I know that the current situation (one old, but separate version and a new version which is a bit tied to the Haskell system in question) is far from satisfactory, but we are working on this. :-) Just another Windoze note: If you are using the GLUT toolkit, the platform doesn't matter, the Haskell code of your OpenGL application is always the same.
but the ghc6-hopengl debian package maintainer (Ian Lynagh) wrote this cute demo script that works with the HOpenGL debs he created:
Two notes on the demo: * Importing Graphics.UI.GLUT is enough, this module re-exports all of Graphics.Rendering.OpenGL. * Instead of makeCapability CapDepthTest $= Enabled simply use depthFunc $= Just Less The former uses internal functions of the OpenGL package, which may change without further notice. Furthermore, the "official" way is a bit nicer and shows one of the design principles of the new API: Instead of separately setting a "cheap" aspect of the OpenGL state (here: the depth comparison function) and enabling/disabling the associated functionality (here: the depth test), a single state variable (here: depthFunc) of a Maybe type is used. So e.g. disabling the depth test is simply done by depthFunc $= Nothing or querying its state by df <- get depthFunc case df of Nothing -> ... -- the depth test is disabled Just func -> ... -- the depth test is enabled and func is used as the -- comparison function I've uploaded the Haddock documentation for the hierarchical libraries including the OpenGL/GLUT packages on http://haskell.org/HOpenGL/newAPI/. Apart from that, Sven Eric Panitz has written a nice tutorial using the new API, see http://www.tfh-berlin.de/~panitz/hopengl/. Cheers, S.

Hi Sven, On Sun, Dec 21, 2003 at 06:04:16PM +0000, Sven Panne wrote: Thanks for taking a look at it!
depthFunc $= Just Less
Aha, thanks, I somehow managed to miss this in my searching. That looks much nicer :-) I'll make your changes, plus switch to using an idlefunc[1] (which I was reminded of the existence of when playing with something else recently - I'm not sure how I ever forgot it!) when I do the next upload. Thanks Ian [1] If anyone knows of a sane way to measure elapsed time between calls to an idlefunc without either peaking inside GHC's ClockTime datatype or resorting to the FFI please let me know...
participants (4)
-
Eric L. Zeltmann
-
Ian Lynagh
-
Shae Matijs Erisson
-
Sven Panne