[HOpenGL] Example Program and Compiliation?

Sven Panne Sven.Panne at aedion.de
Sun Dec 21 18:04:16 EST 2003


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.



More information about the HOpenGL mailing list