Programming assignment 3 - Scene graphs and moving objects

CS 354 - Introduction to Computer Graphics
Spring, 2007
Don Fussell

DUE Wednesday February 28 at Midnight

You are to add some regularly moving objects to the scene. Start by making a sphere (you can use gluSphere and gluQuadricObj) of a reasonable size. Then have it orbit the Menger cube at a reasonable distance, meaning that you can (usually) see it and it doesn't hit the cube. Then create another, smaller sphere, and make that orbit the first sphere, as it orbits the cube. The speeds at which they move should be different in each case, and again, you should (usually) be able to see them, but they shouldn't penetrate anything as they move. Note that they should always be moving, not just when you move the mouse or hit a key. You should regularly post redisplays if you are using glut for this, and you may want to use the glut idle callback for further redisplays.

You should do this by implementing a simple notion of a scene graph using hierarchical modeling. For instance, you can have a root object that is the entire "universe" with a child that is the "large sphere frame" and which in turn has a child that is the "small sphere frame". You may find it helpful to use pushMatrix() and popMatrix() to structure the transforms in your scene as discussed in class.

For extra credit, make some more complex motion, by which I mean objects that move with respect to other objects, like the second sphere does with respect to the first. For example, you could build a simple robot, with a body that rolls along the ground, or, more ambitiously, legs that walk, and with articulated arms and fingers that you control with a mouse (this is ambitious, and would be easier if you've done the scene graph part first). Or just add some more planets to make a "solar system" with the "sun" being the menger cube.