CSE 167 - Introduction to Computer Graphics - Fall 2004
Instructor: Sam Buss,  Univ. of California, San Diego

Project #1 - Modify the Solar System Demo by adding planets and moons. 

Due Date: Tuesday, October 12, midnight.

Goals:  Learn how to use OpenGL and interrupt-driven programming.   Learn some first principles of animation.  Program some additions to an animated solar system.  Use OpenGL commands to generate transformations that control the animation.

What to hand in:  Make a directory called Solar  in your home directory, also called the CSE167 storage directory.  (The CSE 167 home directory on ieng9, under Class Resources, not your "My Documents" folder).  The file modification dates will serve as a time stamp so we will know files have been turned in on time.   Please in that directory, all your source files and project files (including .sln and .vcproj files).   Your folder should be named exactly "Solar" with that capitalization.  Do not name it anything creative like "Project1"!
    Grading will be personalized and one-on-one with a TA or with Sam Buss.  Your program must run on the PC lab, you must come into the PC lab and meet one of us.  You will have to show your source code, run the program, possibly make changes on the spot to your program and recompile as requested by the grader, and be able to explain how your program works and why it renders what it does.
Your files should be complete and the project must recompile in your home directory.   You will then make an appointment to see a TA to get your work graded.  This grading MUST be done by Friday, October 22, and we prefer that it be done earlier.  If too many people procrastinate on getting graded, not everyone will have time to be graded!

    If you want to work on your home machine or other machine:  OpenGL will run on many environments, including linux, unix and macintosh.  You may do development on other machines, but will be responsible for getting your system to work with OpenGL, plus, you must transfer everything back to the PC lab for grading purposes.  If OpenGL or GLUT is not installed on your machine, you will need to download the header files, library .lib files and dynamic library .dll files.  See the "Graphics resources on the main course web page for help on where to find these.

FOR PROJECT #1, DO THE FOLLOWING STEPS #1 - #6.

1. Downloading files for Project #1.  Download the Solar program from the zip file  Fall04SolarProjectOne.zip.  Extract these into a directory named Solar in your home directory.   Since you changed the Solar program in Project #0, you should download it again to make sure you have the right version.

2. Understand the code in the Solar program. Compile and run the program.  Test out the keyboard controls.  When the program 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 (up/down arrow keys) to see the "true" motion.  Figure out how the animation code works.  Understand what was meant by  "aliasing"  three sentences ago.
    Notice also the interrupt-driven style of the program, and how keyboard controls work.

2.  Modify the program to give the Earth a second moon.   The existing planet "Earth" and its moon can keep their current movements.   Add a second moon to the Earth.  Give this moon a retrograde orbit.  That is, the new moon should rotate backwards, i.e., revolves around the Earth in the clockwise direction when viewed from above the Earth's north pole.

3. Convert the sun to be a binary star.  Replace the existing single sun by two smaller suns that rotate around each other in the center of the solar system.  Give them a fairly high orbital rate.

4. Add another planet ("Planet X") with two moons.

5. Adjust the orbital radii, the orbital rates, view distance and view angle, etc. Make changes to the viewing distance, the viewing angle, and to the sizes of the suns, planets and moons and to the radii of the orbits, so as to make viewing the solar system convenient.  This probably includes placing the view point further away from the solar system to reduce the excess perspective.  You may need to adjust the field of view argument to gluPerspective.

6. The 40 degree tilt.   Give the new planet (Planet X) and its two moons a 40 degree tilt.  The kind of tilt is similar to the somewhat smaller tilt of our real earth that causes the earth to have seasons. The orbital path of Planet X should not be tilted; instead the tilt just applies to the orientation of Planet X.  Thus the tilt should always be in the same direction (in the direction of the positive x axis, for instance): it should not always be tilting at the same angle relative to the sun. 
     The orbits of the Planet X moon and its satellite should be tilted by the same amount so that they are always above the equator of the planet.
     The visual effect is that Planet X and its two moons are always leaning rightward 40 degrees.  The orbital paths of the Earth and Planet X should lie in the same plane.

7. (Extra credit).  Modify the period of the earth.  Modify the animation so that the Earth revolves around the sun exactly once every 365.25 days.  You must be careful that there are not any discontinuities in the position or orientation of the Earth and its moons at the end of a year.  In addition, you should design the animation code so that the program will work far into the future and will not ever suffer from floating point overflow problems.  As part of this, clamp AnimateIncrement to avoid underflow and overflow.

Grading:  Grading will be on a scale of 1-10.  The extra credit can add at most 1/2 of a point to your grade. 

Troubleshooting: