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:
- SolarProject.zip: A zip file, including the source files,
Microsoft Visual C++ workspace and project files, and Win32 executable.
- Solar.zip: A zip file, with sources files and the executable.
- Solar.c and Solar.h and Solar.exe:
Download the two source files and the executable, one at a time.
Things to try out:
- 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).
- If you didn't already do this with the SimpleAnim program, try changing
the program to use single buffering, and observe the results.
- Build a more complicated solar system, by doing the solar system exercise from chapter 2
of the book (page XXX).
- 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.