Computer Engineering 519 (Graphics) Project 4 Page



This was the second project using the 3D features of OpenGL. It concentrated on using modeling transformations to move the scene rather than scene transformations. It also introduced lighting, materials, texture mapping, and transparency.

We used the same scene from Project 3, but went from a wireframe model to a "solid" model. The windows needed to be transparent with a control to change their opacity. This feature was implemented using the alpha (or accumulation) buffer functionality of OpenGL. To use transparency, I make the depth buffer read-only, then draw the transparent stuff. It mostly works, but when I turn the opacity all the way up, I can still see the trees through my windows. I think this has something to do with using Quadrics, but I wasn't able to make it stop. I tried modeling both the front and back polygon faces so the normals would be right, but this didn't help.

To interact with the scene, the user must use the moust buttons. If the left mouse button is held down and the mouse is moved left and right, the scene rotates in the +/- Y direction.

If the left mouse button is held down and the mouse is moved up and down, the scene rotates in the +/- X direction.

If the middle mouse button is held down and the mouse is moved left/right, the scene is also translated left/right. Middle and up/down move the scene up and down.

Finally, if the right mouse button is held down and the mouse is moved left or right, the scene rotates on the Z axis. Right mouse button and up/down scale the scene (but, the scaling factor is divided down by 100, so it doesn't scale very well. This is to prevent the scaling from rapidly getting out off hand).

There is also an option to switch between a perspective and orthographic view.

Texture mapping is also enabled. If the program is run from an O2 or Indigo2 with Maximum IMPACT graphics, texture mapping is turned on by default. However, running on an Indy or Indigo2 with less than Max IMPACT turns texture mapping off since it is a serious effort on those machines to do the texture mapping. Note: If you 'run' the program on an Indy and display it somewhere else, texture mapping is still going to be turned off. I am not sure if OpenGL provides some functionality to determine the specifications of the machine on the remote end of a dgld process)

The textures are all 64x64 RGB files. They tend to show up rather dark on lab O2s and rather light on my Indigo. I don't know why that is.

This project also introduced lighting and material properties. My scene has a single ambient light. Most of the house materials have a relatively high reflective material just so I could make sure the light was working. The 'backs' of the polygons have a much more matte finish (as can be seen if the scene is rotated to look through the windows of the house with opacity set very low)

The project also provides a method of drawing solids of revolution.

To draw a new solid, set the depth (Z value) and axis (distance from the first point to the rotation axis) and then click new polygon. The scene changes to a top down perspective. You can select a front or side perspective too, but currently only the top-down view actually works. The others assume the top-down view is used, even if it isn't.

Clicking a few points and then hitting 'End Polygon' will cause the solid to be drawn. Unfortuantely, it doesn't seem to look quite like what I want it to. I am not sure why the spacing is so extreme between the objects.

Despite the huge number of hours spent on this project, I don't feel it is implemented as well as the first 3. Even with the time extensions, I was unable to do the project as well as I'd like.

Code is here

Anyway, screenshots are below.

Figure 1: The Initial Program Appearance (click to enlarge)

Figure 2: The Initial Program Appearance with textures off (click to enlarge)

Figure 3: A view of the windows (click to enlarge)

Figure 4: The opaque windows (click to enlarge)

Figure 5: A view of the 'solid' of revolution (click to enlarge)