CS 480 -- Lighting Demo Lab Exercise -- 4/8/02

  1. Using Windows Explorer, browse to the path M:\CSIS\CINDRICBB\HANDOUT\CS480\LIGHTDEMO; in this folder, you should see two .exe files.  I don't know if you can run programs that are on the Shared drive directly, or if you have to copy them to your H: drive; to save space, first of all try to run the programs from the Shared drive.  Double-click on the file named "lightposition.exe" and see if it works (in my testing, it takes a while for the program to launch and load).  If it works, you'll see two different views of a soccer ball on the screen, with several OpenGL function calls displayed also.  If you don't see such a display after about 20 or 30 seconds, then students at Mount Union can't run programs directly from my Handout space -- so you'll have to copy the entire LIGHTDEMO folder to your H: drive and try to run the program from there.

  2. After you get the "lightposition.exe" file to run, move your mouse pointer to the first argument in the "gluLookAt" function (that's the x-coordinate of the eye of the viewer).  Click and drag the mouse up and down, and watch what happens in both windows.  This is the way that all of today's demos will work:  if you drag the mouse up or down after first clicking on a green function argument value, the value changes up or down, and the change is shown in both display windows.  Move the eye position around, then try to move the center (the point at which the eye is looking).

  3. Reset the values for the center point to (0, 0, 0) and the eye point to (0, 0, 2) -- you don't have exactly get these values, but get close to them.  Then change the position of the light source by changing the four values stored in the array "pos".  The purpose of this demo is to show the effect of the "glLightfv" function in setting the position of a light source.  When you have played with this enough to satisfy your curiosity, close the program.

  4. Using Windows Explorer, double-click on the file named "lightmaterial.exe"; after loading, you'll see two different views of a torus (a doughnut) on the screen, along with several OpenGL function calls.  This demo will show the effect of changing lighting and material values.  To start, change the first three values in the array named "material_Kd[]" to 1.0 -- this should make the torus appear much whiter than it did before.  Next, change the values in the array named "light_Kd[]" so that they represent different colors: Purple (1.0,0.0,1.0), Red (1.0, 0.0, 0.0), Yellow (1.0, 1.0, 0.0), Green (0.0, 1.0, 0.0), etc.

  5. Change the diffuse light color (the one you've been playing with) to bright Blue, then play with the Specular color values (light_Ks[]) -- you should notice that the highlight on the torus is changing color, while the diffuse color of the torus remains unchanged.  Continue modifying values until you have had enough practice.

  6. Now for something really cool!  Change the Diffuse and Specular light colors to white, and then click the right mouse button in the bottom-left window (the world-space view window).  A menu will pop-up that will allow you to select different materials for the torus.  Try some and see what happens!  Notice that when you select a different material, the values in the material arrays change.

  7. Right-click in the upper-left window (the screen-space view window).  A different menu will pop-up that will allow you to select different shapes to display!  Not all of the shapes are available to you, because I didn't copy them all to the Shared drive, but try to load "Al Capone" into the window.  Then drag the mouse (with the left button) around the upper-left window -- how cool is that?!? I think you can load Al Capone and the Soccer Ball, as well as the Torus.

    We will discuss more lighting and materials properties in class on Wed., April 10.  See you then.