Solar

Solar is sample C code illustrating the use of OpenGL.   It is intended to accompany the book 3D Computer Graphics: A mathematical approach with OpenGL, by S. Buss, Cambridge University Press, 2003.   However, it can be used independently as well.

Solar animates a simple solar system, with a sun, a single planet and a single moon.   It consists of two source files, Solar.c and Solar.h.   There are several options available for downloading this program:

Things to try out:

  1. Compile and run the program.  Test out the keyboard controls.  When it first starts, aliasing causes the planet to appear to not be rotating, but instead always keeping the same face to the sun.   Slow down the animation (arrow keys) to see the "true" motion.  Figure out how the animation code works (refer to chapter 2 of the above-mentioned book).
  2. If you didn't already do this with the SimpleAnim program, try changing the program to use single buffering, and observe the results.
  3. Build a more complicated solar system, by doing the solar system exercise from chapter 2 of the book (page XXX).
  4. The perspective view is set up poorly for some situations.  Try, for instance, making a tall skinny window; note that the solar system is no longer fully visible.   Rewrite the ResizeWindow routine to fix this problem.