Due: Monday, Oct. 31, 11:59pm
FINAL VERSION - although I might add some more notes or comments as I get feedback from students
STEP1 - Basic viewing
3D viewing: Implement a 3D viewing program to view a groundplane:
- Depth buffer
- in main, set mode to include DEPTH
- in graphics initialization code, enable the Depth_TEST
- at the beginning of every display clear the Depth Buffer along with the Color buffer
- use glLookAt() to set the camera, look at the origin
- set glPerspective() or glFrustum() to something reasonable: make sure your 'near' and 'far' clipping limits can accomodate reasonable camera movement.
- Double buffer
- in main, set mode to include DOUBLE
- and the end of your display routine, glutSwapBuffers() - before the flush)
Display lists: Define objects and use display lists:
- you can use OpenGL built-in objects (e.g. glSolidCube(), glSolidTeapot()) but you must define at least one 3D object with normals.
- use glGenLists(), glNewList(), glCallList() to define and use objects and normals
- define a simple groundplane using a single polygon +/- 100 in x and z at y = 0 or use a cube of the same extent in x and z with top at y=0; use display list to define the cube: GenLists(), NewList(), EndList(), CallList()
Mouse movement: to control the camera
- Define &theta, rotation around the y-axis, and \phi, rotation around the z-axis +/- relative to the x-axis, parameters for the camera, and distance from the origin
- compute the cameras x,y,z position from the parameters
- left mouse button
- record x,y screen locations when left mouse button depressed
- compute dx,dy when mouse is moved with left button down
- convert dx and dy into delta-\theta and delta-\phi, update the angles and recompute the camera position
- middle mouse button
- record y screen locations when middle mouse button depressed
- compute dy when mouse is moved with middle button down
- convert dy into zoom-in and zoom-out by modifying distance that the camera/eye is from the origin
- use up and down arrows on keyboard to zoom in and zoom out by modifying the distance parameter of the eye/camera
|
|
STEP2 - simple lighting
Lighing: Add one or more simple lights to the scene and material properties to objects
- during initialization, enable lighting, turn on light 0, setup light 0 using glLightsfv() with ambient and diffuse color.
- at each display, set the position of the light right after the LookAt command
- instead of using 'Color' to color objects in your scene, use glMaterialfv()
- Make sure the normals for the data you use are correct and normalized - either by you or by OpenGL
|
|
STEP3 - hierarchical animation & key control
Hierarchical animation: Implment a scene of stacked cubes using relative translations and matrix push/pop commands.
- create a stack of scaled cubes to form a column as in the example to the right
- Animate the angles at the joints of the stacked cubes.
- update state function (called by keystrokes 'c' and 's')
- update each angle by some delta value
- test the updated angle against angle limits and negate the delta value if exceede
- if 'animate', issue glutTimerFunc to call itself
keyboard input: to control the program
- 'r' - reset camera, animation variables, single step mode
- 'q' - quit
- 'c' - continuous run: set 'animate' to TRUE, call update state
- 's' - single step: set 'animate' to FALSE, call update state (default: start in this mode and reset to it)
- 'up arrow' - zoom in
- 'down arrow' - zoom out
|
|
STEP4 - complex hierarchy
Complex hierarchy: implement at least one case of a multiple degree of freedom joint and at least one case of two branches in the hierarchy.
In my example lab, starting from the bottom, my joints are
- one degree of freedom: x-axis rotation
- two degrees of freedom: x-axis rotation, z-axis rotation
- one degree of freedom: y-axis rotation
- the claw:
- rotate about z-axis by a, then translate by delta in x
- rotate about z-axis by -a, then translate by -delta in x
|
|