OpenGL screensavers, L-systems, and the Hilbert curve

Introduction

Writing a screensaver for Windows is a pain.  I developed a template library called "glsaver" and the accompanying MSVC++ 6.0 project files that make it very simple to create an OpenGL screensaver using a GLUT-like interface.  The file blank.cpp in the project demonstrates how to use the interface; see the header glsaver.h for more details.  To build your own screensaver, replace blank.cpp with your own source file and modify the project resources as desired.

Download glsaver

Lindenmayer systems and the Hilbert curve

As an example of what can be done with "pure" OpenGL, I have also written a screensaver using the template that draws a 3D Hilbert space-filling curve.  See the download link and screen shot below.  Both the executable and source code are included.

The curve is generated by a Lindenmayer system, or L-system, in which an initial string of symbols is repeatedly transformed using a fixed set of "production rules."  By interpreting some of the symbols as Logo-like relative motion commands, the L-system acts as a concise description of a complex pattern.  The Hilbert curve, in addition to being interesting to watch as it is constructed, has applications in image processing (e.g., compression) where continuity of traversal of an image is important.

Download Hilbert screensaver and LSystem source code

Screen shot

Eric Farmer
erfarmer201@comcast.net


Created by Mathematica  (July 8, 2003)