View Full Version : Functional OpenGL?

03-03-2002, 11:55 AM
Is there any work on functional OpenGL or an OpenGL-like-API that provides a functional interface?

In traditionla graphics (PHIGS, Hoops, OpenGL) the interface for the programmer is closely tied to the how the machine is going to perform the graphics operations. The programmer has to think about the order of operations. Functional programming (in the spirit of functional languages) tries to simplify the interface and focus on describing the objects.

I do not wish to get into a discussion on whether functional languages are better or whether graphics should be functional or not.

If you can, please point me to articles/systems which take a different approach to the API than OpenGL does.



03-03-2002, 12:14 PM
OpenGL Inventor ( http://www.sgi.com/software/inventor/ )provides a scene graph abstraction of OpenGL.

[This message has been edited by Lighthouse (edited 03-03-2002).]

03-03-2002, 12:40 PM
I'm not quite clear what it is you want. Your "focus on describing the objects" sounds distinctly object-oriented rather than functional. There are certainly any number of OO graphical APIs.

As for truly functional... I don't really see how this is feasible. The core ideal of functional languages is to do away with program state and side-effects, and unless you want to treat the entire framebuffer as a return value, graphics is all about side-effects. The FP community had a hell of a time working even basic I/O into their models, for just this reason.

You might want to take a look at the vertex and fragment shaders in the GL2 proposals. These specific subsystems *are* quite functional in nature; they're both geared toward calculating a single value, and they both need to eliminate side-effects in order to enable hardware parallelism.

For a complete graphical API, though, I think you're out of luck.