[clean-list] OpenGL in Clean

ESummer@lcc.edu ESummer@lcc.edu
Mon, 8 Jul 2002 18:14:08 -0400


I would also love to see OpenGL for clean.  I see a few problems with it
though.

The lack of support for single-precision floating point numbers in clean
would  definitely be a disadvantage.  It would not be possible to support
interleaved arrays because they don't work with double-precision reals. The
extra precision is usually not needed in most GL apps, so it  would also be
nice for space savings.  I don't think that Clean's optimizer handles real
numbers very well either (correct me if I'm wrong) and may be slow compared
to a c application.  In haskell that's not a problem because it can use gcc
as an output, therefore uses gcc's floating point optimizer.
Unfortunately, it's probably not trivial to add support for this in clean.
I like the design of HOpenGL for haskell and would probably be a good place
to start for clean.  I was thinking about writing a binding for clean
myself, but am distracted in other projects right now.  It should be easier
then haskell's binding due to cleans use of macros.

As for as clean being a good language for OpenGL programming, I think it is
excellent.  The fact the OpenGL is a state based machine shouldn't effect
functional programming style.  Most of the time when programming for OpenGL
you work on a scene graph then use the scene graph to optimize and send
state information to OpenGL.  That would allow you to program without
threading stuff around imperatively.  Scene graphs seem very natural to
write in functional programming languages, although i don't think anyone's
released one yet.  In fact any large c/c++ program also uses a scene graph.
Some scene graphs for c and c++ include OpenRM, Open Scene Graph, SGI
OpenInventor, SGI Performer, and most games use some form of scene graph.
Also graphics algorithms are much more natural to write in clean then c.  I
am experimenting with writing a scene graph for haskell that uses reactive
programming like in FRAN at the moment.

Off topic, but does anyone know if clean plans to support weak pointers in
its garbage collector?  It's a neat trick for caching data you don't know
if you will need again that i find useful.

later,
Eric Summers