CSE 581 Lab 2 (12 points)

Due: Friday, November 3rd, 2006 11:59pm


Objectives:  You are expected to learn:

  • Modeling using OpenGL/GLU/GLUT 3D primitive
  • 3D transformation and hierarchical transformation
  • OpenGL 3D camera and projection setup
  • OpenGL double buffer and depth  buffer


Tasks:  Write an OpenGL 3D drawing program with the following features:

1. (1 pts)  Set up OpenGL 3D projection and viewing matrices using gluPerspective() and gluLookat(). Position the camera at a proper position so that you can see the entire scene.

2. (5 pts) Use glut/glu primitives (cube, cone, cylinder, torus, disk, etc) to construct a 3D scene. The 3D scene should contain one or multiple objects, where at least one object (the main object) should have multiple moving parts and has a minimum of three levels in the hierarchy. Allow the user to press ‘f’  key to move your main object forward by one step, and ‘t’ to turn by 90 degree to its left.

3. (2 pt) Implement one or multiple additional keys to control the movement of your main object’s movable parts. You need to describe how this works (the key(s) and the desired actions) in a readme file.

4. (0.5 pts) Use key stroke 'w' to toggle between drawing solid or wireframe. There are two ways you can draw wireframes in OpenGL

  • If you are using glut objects, you can use glutWire*** functions instead of glutSolid*** functions (e.g. glutWireCube()) 
  • Or, you can use OpenGL's glPolygonMode() function to indicate that a polygon should be drawn as a set of lines (the default is filled)

5. (1  pt)  Use OpenGL depth buffering feature to display the solid objects in a correct visibility order.
    This is done by calling the following functions:

·  glutInitDisplayMode(GLUT_RGB|GLUT_DEPTH) in your main program and

·  glEnable(GL_DEPTH_TEST) in the beginning of your display function.

·  Make sure that the near plane parameter in the gluPerspective() call is not zero.

 

6. (0.5 pt) Use OpenGL double buffer for all the drawing.

 

7. (2 pts) Make you object(s) 'alive' by allowing it to animate automatically

  • Use the key ‘a’ to toggle the animation
  • All parts are moving automatically (based on your design) when animation is on
  • Automatic updates of frames can be achieved by registering a callback function to glutIdleFunc(). You will write the callback function, where you will update the transformation parameters and redraw the screen using glutPostRedisplay()

8. You need to have a detailed readme file explaining how to control your object(s) with key strokes  

Below are some sample images of a Robot made of cubes. You cannot create the same object for this lab. Also, remember if you use results from students who took this course previously, it can be very easily spotted and you will be sent to the committee of academic misconduct. So don’t do this.