OpenGL accelerated Game of Life
 

The Breeder in perspective

glLife implements John Conway's famous cellular automaton Life using OpenGL to accelerate computation and display.

Although with current graphics hardware this is not necessarily the fastest way of computing Life, OpenGL does allow for some interesting display possibilities, including fractional zooming, rotation and even perspective views of the cell universe. If nothing else it's a fun piece of video art.

On an SGI 320, glLife gets around 12 frames per second with a 1024 x 1024 universe, which is 12 million cell updates a second. Note that the algorithm computes and displays every cell every frame, and so this performance is independent of the pattern complexity. With the ever increasing fill rates and parallelism of graphics hardware it may one day become faster doing it this way than using the CPU.

STOP PRESS - glLife reaches 16 million cell updates / second on GeForce 2 Ultra with Detonator 3 drivers!

You will need a Windows machine with OpenGL hardware that supports the stencil buffer and destination alpha (this may require switching to a true color display on some systems). The code has been tested on NVidia TNT, GeForce, GeForce 2 and the SGI 320, on anything else you're on your own.

The algorithm used is basically that described in the OpenGL Programming Guide (p.589 in the 3rd edition). The state of the cell universe is maintained in the frame buffer, and the next generation is computed using texture mapping and the stencil buffer to count neighbours, followed by the stencil test to determine which cells should live or die. In total 10 rendering passes are required per update. See the readme file or the example source code below for more information.


Gosper's Glider Gun in orthographic view, 45 degrees rotated
 

Download (Win32 binary)
New! Download source (C OpenGL/GLUT source to simplified version)

Links

Simon Green

last updated 8/26/2002 1