HOpenGL is a Haskell binding for OpenGL (GL 1.2.1 / GLU 1.3) and GLUT
for the lazy functional language Haskell. It uses a foreign language
interface and complex instance heads, language extensions which are
not yet fully standardized. Because of this, HOpenGL works only with
recent versions of the Glasgow Haskell Compiler (GHC) and Hugs. With
a little work it can probably tweaked to work with NHC98, but this has
not been tested yet. Following the discussions in the relevant mailing
lists, the above extensions are likely to be included into the next
version of the Haskell language, so HOpenGL is simply a little bit
ahead of time...  ;-)

The actual version number is contained in the file VERSION.
Installation instructions are in the file INSTALL.

Documentation has only been written for the GLUT part, for the rest
have a look at the examples subdirectory and compare the corresponding
C-files with their Haskell counterparts. The file DESIGN contains some
additional information.  "Use the source, Luke!"  :-) Apart from that,
it should be noted that Andre W B Furtado has written a fine tutorial
for HOpenGL. It's available at http://www.cin.ufpe.br/~haskell/hopengl/.

Features:

   * Strong typing:

     Have you ever asked yourself if GL_INTENSITY is a pixel format or an
     internal texture format? Is GL_CLEAR a valid stencil test action?
     GHC will tell you now...

   * Consistent naming of OpenGL functions/constants without ugly prefixes:

        glGenTextures            => genTextures
        gluLookAt                => lookAt
        GL_COMPILE_AND_EXECUTE   => CompileAndExecute

     There are very few exceptions from this rule, most of the time only
     a tick is appended.

   * Better interfaces to match Haskell, e.g.:

        * a single function for fogging:
          `fog (FogColor (Color4 0 0 0 1))' or
          `fog (FogDensity (FogLinear 1 5))'

        * lists instead of bit-ops:
          `clear [ ColorBufferBit, DepthBufferBit ]'

        * a single type safe function for state inquiry:
              get :: param -> IO val
           e.g.
              get VarCullFaceMode
           (returns a value of type Face) instead of
              GLint i; glGetIntegerv(GL_CULL_FACE_MODE, &i);
           or
              get VarMaxViewportDims
           (returns a value of type (GLint, GLint)) instead of
              GLint i[2]; glGetIntegerv(GL_MAX_VIEWPORT_DIMS, i);

        * a monolithic and easy to use function for menu creation:
          attachMenu MiddleButton [
             MenuEntry "quit" (putStrLn "quit"),
             SubMenu   "Colors" [
                MenuEntry "Red"   (putStrLn "Red"),
                MenuEntry "Green" (putStrLn "Green"),
                MenuEntry "Blue"  (putStrLn "Blue")]]

        * Callback-free APIs for quadrics and tesselation

Related URLs:

   * HOpenGL:  http://www.haskell.org/HOpenGL/
   * OpenGL:   http://www.opengl.org/
   * GLUT:     http://www.opengl.org/developers/documentation/glut.html
   * Haskell:  http://www.haskell.org/
   * GHC:      http://www.haskell.org/ghc/

Credits:

I have to thank the following people for tireless beta-testing and
lots of helpful suggestions and improvements:

   * Manuel M. T.Chakravarty   mailto:chak@cse.unsw.edu.au,
                               http://www.cse.unsw.edu.au/~chak/
   * Andre W B Furtado         mailto:awfurtado@uol.com.br
   * David Duke                mailto:D.Duke@bath.ac.uk
                               http://www.bath.ac.uk/~masdad/
   * Michael Weber             mailto:Michael.Weber@Post.RWTH-Aachen.DE

BSD-style Copyleft:

Copyright (c) 2002, Sven Panne
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice,
   this list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright
   notice, this list of conditions and the following disclaimer in the
   documentation and/or other materials provided with the distribution.

3. Neither the name of the author nor the names of its contributors may be
   used to endorse or promote products derived from this software without
   specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.

--
Sven Panne
mailto:Sven.Panne@{informatik.uni-muenchen,BetaResearch}.de
