penumbra
penumbra copied to clipboard
not under active development - idiomatic opengl bindings for clojure
Port of legacy Penumbra circa Clojure 1.2 to Clojure 1.8+
This is an update of Zach Tellman's impressive penumbra library. All of the legacy cruft from clojure.contrib has been migrated or removed. Currently this is a stability release intended to get the examples working. They all compile and run, however, many of the examples that rely on shader implementations (like a bunch of the demos in test/examples/opengl) rather than the fixed function pipeline, will drop out when you run them.
I'm not sure where to go with this library, but it seemed a waste to leave it in the dustbin. I'm currently evaluating alternatives for rendering, and I remembered penumbra. -Tom
Penumbra is not under active development. However, it's still a fun way to play around with OpenGL and Clojure. Bugs will be fixed, time permitting, but new features are unlikely.
Penumbra is an idiomatic wrapper for OpenGL in Clojure, by way of LWJGL.
This Java/C code
glEnable(GL_LIGHT0);
glPushMatrix();
glTranslated(0, 0, -10);
glBegin(GL_QUADS);
glVertex3d(0, 0, 0);
glVertex3d(0, 1, 0);
glVertex3d(1, 1, 0);
glVertex3d(1, 0, 0);
glEnd();
glPopMatrix();
becomes
(enable :light0)
(push-matrix
(translate 0 0 -10)
(draw-quads
(vertex 0 0 0)
(vertex 0 1 0)
(vertex 1 1 0)
(vertex 1 0 0)))
Numerous sample programs can be found in @/src/example@. They include clean, functional implementations of "Tetris":http://github.com/ztellman/penumbra/blob/master/test/example/game/tetris.clj and "Asteroids":http://github.com/ztellman/penumbra/blob/master/test/example/game/asteroids.clj, and a GPU-driven "Mandelbrot viewer":http://github.com/ztellman/penumbra/blob/master/test/example/gpgpu/mandelbrot.clj.
A long term goal for Penumbra is to simplify GPU programming as much as possible, allowing for both advanced graphical effects and general computation. This is a work in progress, but this "n-body simulation":http://github.com/ztellman/penumbra/blob/master/test/example/gpgpu/n_body.clj is a good example of what's possible.
h3. Using Penumbra
Directions for installation and use in other projects can be found "here":http://wiki.github.com/ztellman/penumbra/getting-started.
If you have any questions, please visit the "mailing list":http://groups.google.com/group/penumbra-lib.