What is the simplest way to render a 3D cube with a single lighting source?

Depicted below is a crappy Photoshop mockup of a three-dimensional cube.

a crappy 3D cube

Here are my parameters: The solution must...

  • ... compile and run on my dinky but faithful Macbook Air without using Windows emulators like wine
  • ... produce a window that looks reasonably close to the above mockup when run
  • ... use only free tools ("free" as in "speech" and "beer")
  • ... use C (not C++ or C#)
  • ... be capable of rendering the cube viewed from different angles defined at compile-time, perhaps with preprocessor macros
  • ... make use of the GPU


Potential resources:


I would go to Nehe tutorials, 1-5. By the #5 you'll be rendering the above cube in OpenGL.

The tutorials are straight C, but they have links to ports at the bottom of the page for just about every language you might want to use.

Nehe OpenGL