Program 4, Due Wednesday November 10th before midnight
Objectives: Expand our basic 3D interactive graphics programming. We will learn about lighting and walking around objects (versus rotating objects). We will use our first scientific visualization. We have implemented a trackball from the previous program. We can manipulate the object using the trackball. We can choose between polygons, wireframe, or points. All of this functionality should remain intact.
Required input files: You should be able to run your program with any input file. (Start with the small ones!)
To
Do:
Walk Around: Be able to alter the camera position so that the user can "walk around" the scene and see it from any direction. Use gluLookAt to move the eye position, which is set by 3 translate sliders on the GUI. The LookAt position should be the center of the scene and the up position should remain (0,1,0).
Objects: You will be placing glut-primitives on top of your height field. A sphere, a torus, a cube, and a teapot should be placed on TOP of your height field. (You will have to recalculate their positions as I increase and decrease the height field). The objects should be large enough to see, yet small enough so as not to obscure the entire height field. I expect that the objects will obstruct ¼ to ½ of the height field.
Materials: The height field should be a very shiny white color when it is solid, so that you can see specular highlights. Each of your glut primitives should be a different color. The cube should be a non-specular, diffuse red. The torus should be a semi-transparent light blue. The sphere should be a very specular but also diffuse yellow. The teapot should be a shiny green.
Lighting: There should be
three lights: a yellow spotlight that shines distinctly on the shiny floor,
i.e., makes a distinct yellow spot; and a cyan positional light that is above
and on one side of the ground grid; and a white directional light shining
straight down. Also make a white ambient light.
Make toggle buttons on the GUI to be able to turn these each on and off. If you
turn them all off, you shouldn't see anything but black. Each light is defined
by a numeric constant (its name), and you only need to glEnable(name) or
glDisable(name) to turn lights on and off. The ambient light must be
turned off by a separate command. To turn it on and off, you use glLightModelfv(
GL_LIGHT_MODEL_AMBIENT, worldAmbientOn ), where worldAmbientOn or
worldAmbientOff are the RGBA values that the ambient should be when on or off.
Grading: We must be able to compile/test your code. We’ll need your code, makefile, and README for this assignment.
80 pts: functionality (15- implementing walk around, 15- placing objects on top of height field, 15- setting up the material properties, 25- setting up the lighting, 10-usability of GUI).
20 pts: style (documentation/README/commenting/readability.
Extra credit:
- Be able to “roll” the sphere along the height field. You will get some credit if you simply move the sphere along also.
This may be user controlled or animated, if it is animated, make sure you can reset the sphere after the animation (maybe a toggle light button) Maybe the position the sphere rolls to is the bottom of the height field?
Submission: The class locker exists. The name is cmps160-dw.f04.
To submit a program %submit cmps160-dw.f04 program4
filename filename …
For Example:
% submit cmps160-dw.f04 program4 main.cxx Makefile
gui.cxx gui.h \ gl_window.cxx gl_window.h README
To check what you have submitted %peek cmps160-dw.f04 program4