[clean-list] Re: Accessing OpenGL functions

Maks Verver m.verver@student.utwente.nl
Mon, 17 Feb 2003 20:25:12 +0100


Hi everyone,

Adrian Hey wrote:
> Seem's like you're trying to put people off FPL's for life. 
> They aren't that difficult to learn and you shouldn't under 
> estimate 13 year olds :-)

I think that if you start with an underestimation of the language's
difficulty, you are likely to run into frustrating problems, which may
well result in never wanting to work with the language ever again.
That's not really what we want, either, is it? Ofcourse, anyone that is
interested in learning a functional language should attempt to do so,
but if your goal is making computer games, you might be better off
looking somewhere else (at some of those easy-to-use game builder
applications, for example).

> As for the original question, I also have no idea how to 
> access OpenGL from Clean. (That doesn't mean it's impossible 
> of course.) You can do it in Haskell using HOpenGL..
> 
>	http://www.haskell.org/HOpenGL/

I believe there is a tool for converting C header files to Clean as
well, so you could use the C library directly from Clean, but you would
completely ignore the functional programming style this way. OpenGL is
very 'imperative' by design. The OpenGL 'driver' (at least at
application level) has a global state that is modified by OpenGL
commands from the application, wich contradicts the stateless functional
paradigm. Ofcourse, you could write a 'good' functional OpenGL wrapper
around the basic library. However, I think doing this well would be a
tremendous effort, easily as much work as writing the game itself.

> Whether either language (Clean or Haskell) is good for gaming
> probably depends on the game in question. I think they'd be
> good for games of "intellect" (like chess,go etc). But if you
> need top notch real time arcade quality 3D graphics and sound
> effects for alien zapping style games they might not be the
> best choice.

The Clean Game Library by Mike Wiering (http://cleangl.sourceforge.net/)
shows that it is very well possible to write arcade-style games in
Clean. I suppose it's not "top notch" graphics, but it's decent in terms
of performance and image quality. Studying it's internals might be
interesting (although I must admit I never did), as I suppose it covers
much of "how things are supposed to be done" in a functional game.

Unfortunately, the game library does not support anything 3D, so if
producing 3D grapics is a requirement, it's not a definite answer to
your problem. Nonetheles, I think it's a very good way to start, if you
want to learn how to program games with a functional language. The
website contains a lot of sample games, and a short tutorial.


Kind regards,
Maks Verver.