Visualization, Spring'98, Yap

HOMEWORK 1:
ROTATING COLOR CUBES

  1. DUE: February 19.

  2. INTRODUCTION

    In this exercise, we want you to put up a cube inside another cube (somewhat similar to the jello demo). We want to be able to rotate the two cubes independently. You will need to invoke basic GLUT functions for window interface and interactivity.

  3. DETAILS

    -- You must do this in a team of 2 or 3. Here are some instructions for forming teams. -- Check out the jello demo (see programming homepage below) for a model of what we want.
    -- The viewer eyepoint may be fixed by an initial translation (say along the negative z-axis), but the two objects can rotate independently about the origin.
    -- Outer cube: its near faces rendered in GL_LINE mode (so it is transparent) while its far faces are rended in GL_FILL mode. This way, we can see inside this outer cube.
    -- Inner cube: render it the usual way that solids are rendered (hidden surface removal applied, so the far faces are not seen).
    -- There is a light source which you can fix at some convenient spot ``above'' the scene. See glLightf() [Angel, p.239].
    -- Each cube has its own color scheme at each vertex. The shading can switch between smooth and flat.

  4. USER VIEW/INTERFACE

    -- The window must show the following radio buttons:
    • Continuous Spin (on or off)
    • Shading (Smooth or Flat)
    -- NOTE: radio buttons can only be in one of two states (in/out or on/off). While you can do very artistic 3-D buttons (in OpenGL, you can actually model this), we would be happy with a simple solution like displaying a tick inside a small box.
    -- Use glut pop-up menus (see Angel) that offer the following choices: quit, reset (and anything else you want).
    -- Use mouse for rotation: left button for outer cube, and middle button for inner cube. The rotation is defined by the vector v=(x'-x, y'-y) between the mouse button press (x,y) and the mouse button release (x',y'). The amount (if continuous spin is off) or speed (if continuous spin in on) of rotation is proportional to the length of the vector v. The axis of rotation is the normal to the plane defined by the triangle (0,0,0), (x,y,1), (x',y',1).

  5. PROGRAMMING AID

    -- We have set up a general programming homepage in which we try to put in useful information related to programming.
    -- BACKGROUND: The first 5 chapters of [Angel] to varying degrees will be sufficient, plus delving into the [Guide], [Manual] or [glut reference] as needed.

  6. WHAT TO HAND IN

    -- Email the T.A. (and cc to me) the directory in which your solution is found. This directory must be world readable though not writable.
    -- There must be a Makefile, and all we need to do is to copy your files into our directory and say "make" to compile your example. For your Makefile, please modify the Makefile from ANGEL'S BOOK EXAMPLES. Also name your main program h1.c to save us trouble.
    -- There must be a README file containing the following information:
    1. Identifies this as Homework 1 for this course.
    2. Identifies your team members.
    3. A brief statement saying who is (mainly) responsible for which part of the homework.
    4. Any ``user'' instructions or hints for using your program.
    5. You may tell tell us about any interesting experience you have learned from this homework.

  7. ADDITIONAL NOTES

[PREVIOUS HOMEWORK] [NEXT HOMEWORK] [ALL HOMEWORKS] [CLASS PAGE]