Instructor Notes

OpenGL Programming

Revision 4.0, April 1999
Operating System(s): IRIX 6.5; Windows NT 4.0
Release Status: MR
Course Code: OGL_4.0_6.5


Contents


How to Prepare for this Course

Required Instructor Skills and Experience

Recommended Reference Materials and Outside Reading

Return to top


Important Notes

Return to top


Recommended Schedule for Modules and Labs

The schedule shown here is approximate. The Rendering Text module at the end is optional. Your students may prefer to spend more time on Texture Mapping.

Time MONDAY TUESDAY WEDNESDAY THURSDAY FRIDAY
9:00 Student Introductions Review Review Review Review
9:30 Basic Transformations Animation Improving Performance Texture Mapping
10:00 Introduction
10:30 Scene
Modeling
Viewing Rendering Text (optional)
11:00 Windows
11:30 Alpha Blending Wrap-up
12:00
12:30 Lunch Lunch Lunch Lunch
1:00
1:30 Rendering Viewports Lighting Alpha Blending
2:00
2:30 Depth
Buffering
Texture Mapping
3:00
3:30
4:00 Basic Transformations Animation
4:30
5:00 Open Open Open Open

Return to top


Changes from Beta Release to This MR

Changes from Prior Release to Beta Release

This course replaces our previous OpenGL Programming 1 (OGL1) and OpenGL Programming 2 (OGL2) sequence.

Return to top


Current Contact for this Course

Questions, comments, or concerns should be addressed to the appropriate individual listed below.

The current course developer for the OpenGL Programming course is:

BJ Wishinsky, bj@csd.sgi.com, x32355

Contact for Global Customer Education's course repository:

Chris Taylor, ctaylor@csd.sgi.com, x35594

Return to top


Contributors

Course development by BJ Wishinsky.

Based on earlier development by Dave Shreiner, Kris Solem, BJ Wishinsky.

Technical review and contributions by Chuck Adams, Allen Akin, Roger Bush, Ziv Gigus, Benedikt Kessler, Gene Koh, David Marsland, Richard Raffals, Dave Shreiner, Vicki Shreiner, Mason Woo.

Thanks to Merdi Rafiei for helping make the programs Windows-friendlier.

Editing by Mary Erickson, Mike Sather.

Return to top


Reporting Bugs or RFEs

Return to top


Module by Module Notes

Module 1 - Introduction

Need to Cover

Lecture

Lab

Other

Notes

You might want to run some of the example programs from other modules, or have the students do this during the lab.

Under IRIX all of the example and demo programs can be run from the buttonfly program by running the ~opengl/RUN_DEMOS script.

Under Windows NT all the example and demo programs can run from the opengl.fnd script. Run the script either from a Command Prompt or from Windows NT Explorer.

Caveat: Students following the instructions in Appendix A for setting up a Visual C++ project should not remove the console window, since their lab programs will have keyboard input. Announce this at the beginning of the lab.

Review Questions

Return to top

Module 2 - Windows

Need to Cover

Lecture

Lab

Review Questions

  1. How do you create a window using GLUT?
  2. What is the default display mode?
  3. How do you clear the window?
  4. What is the default clear color?
  5. What is the difference between glFlush() and glFinish()?
  6. How are errors handled in OpenGL?
  7. How do you get keyboard input using GLUT?
  8. How do you force GLUT to redisplay your scene after you have made some changes?

Return to top

Module 3 - Rendering

Need to Cover

Lecture

Lab

Review Questions

  1. What is rendering?
  2. What is a vertex, how is it represented, and how is one specified?
  3. What are world coordinates?
  4. What is the viewing volume and how is it defined?
  5. Name the three types of geometric primitives. How are they created?
  6. What is modeling?
  7. What is a convex polygon?
  8. How many faces does a polygon have, and which one is in front?
  9. Name the shading models, and describe them. Which is the default?

Return to top

Module 4 - Basic Transformations

Need to Cover

Lecture

Lab

Other

Notes

The transformation and projection exercises use the tutorials in the demos/GlutTutorials directory. Both labs are positioned before related material has been presented. Some instructors prefer to have the students do these labs after the related material (i.e., slide 6 after slide 9, and slide 12 after, perhaps, slide 19). Whichever order you are comfortable with is appropriate.

There is more than one way the students might come up with the pictures in the exercises. You should play with these tutorials to familiarize yourself with them, so that you will be prepared for the different answers the students might come up with.

Don't dwell on the viewing transformation for very long, since there is an entire module on it later.

Review Questions

  1. What are the three transformations, and how are they similar to the camera analogy?
  2. What are the modeling transformations?
  3. What are the projection transformations? (briefly describe each)
  4. Why are matrices important?
  5. Name the matrix stacks discussed in this module.
  6. How do you save and restore items on the matrix stack?

Return to top

Module 5 - Scene Modeling

Need to Cover

Lecture

Lab

The instructions for these labs cover the basics of what is covered in each module. Starting with this lab, the students are given two sets of instructions. The main set involves adding features to a solar system program. Some students may want to build their own scene or something more challenging, so another set of more generic instructions is provided with each lab. These instructions generally ask the students to combine features, or use them in more complex ways.

Other

Notes

There are solutions to the exercises, and extra worksheets in the back of the module in the student manual.

Review Questions

  1. Why is transformation order important?
  2. How can you apply independent transformations for different objects in your scene?

Return to top

Module 6 - Viewports

Need to Cover

Lecture

Lab

Review Questions

  1. What is a viewport?
  2. What happens if the aspect ratio of your viewport doesn't match the aspect ratio of your viewing volume?
  3. How do you reset the viewing volume when the window is resized?

Return to top

Module 7 - Depth Buffering

Need to Cover

Lecture

Lab

Notes

There is a fairly lengthy discussion on depth buffer precision in the module summary.

The polygon offset discussion has been updated regarding changes in OpenGL 1.1. The example and sample lab answer programs are ifdef'd so they can be compiled and run on systems that don't have OpenGL 1.1.

Review Questions

  1. What is the painter's algorithm, and what are its limitations?
  2. How do you request a depth buffer, how do you clear it, and how do you enable depth buffer testing?
  3. Why was polygon offset introduced?
  4. What does the polygon offset feature do?
  5. What does glCullFace() do?

Return to top

Module 8 - Animation

Need to Cover

Lecture

Lab

Review Questions

  1. How do you animate your program using GLUT?
  2. What causes flicker, and how does double buffering solve this problem?
  3. Why do double buffered programs appear to run slower?
  4. How do you make sure that your program doesn't waste CPU cycles when your program isn't visible?
  5. How do you create a menu using GLUT?
  6. When might you want to change a menu entry?

Return to top

Module 9 - Viewing

Need to Cover

Lecture

Lab

Other

Review Questions

  1. What is the default orientation of the camera (eye)?
  2. When might you use gluLookAt()?
  3. When might you use polarView()?
  4. How do you tell GLUT you want to get mouse input?
  5. What is unusual about the y value passed to your mouse callback (when using the X window system)?

Return to top

Module 10 - Lighting

Need to Cover

Lecture

Lab

Notes

This is a long module. The first lab (material properties) provides a natural point for a break.

A set of routines for manipulating 3D vectors is provided in liboglprog.a. The source is in the file /usr/people/opengl/lib/vect3d.c.

It is recommended that before teaching you spend some time getting comfortable with the new lighting tutorials, lightmaterial and lightposition in ~opengl/demos/GlutTutorials.

There is an appendix on color index mode which can be included when the students require this information.

Review Questions

  1. What do you have to do to light an object?
  2. What is a normal, and how are normals specified?
  3. What is a normalized normal, and how do you create one?
  4. What are material properties used for?
  5. Describe each of the material properties that can be set.
  6. What optimization can you make if you are setting the same property for many different objects?
  7. How do you set light source properties?
  8. Describe the ambient, diffuse and specular light intensity properties.
  9. How do you create a light that moves with the eye?
  10. How do you create a light that stays fixed in the scene?
  11. How do you create an animated light?
  12. How do you create objects that have different materials on the inside and outside?

Return to top

Module 11 - Improving Performance

Need to Cover

Lecture

Lab

Notes

The new vertexArray example program is ifdef'd so it can be compiled and run on systems that don't have OpenGL 1.1. In the Beta release, only the 1.1 version is shown in the presentation. This will be updated for MR.

Review Questions

  1. What are vertex arrays useful for?
  2. What is the difference between glDrawArrays() and glDrawElements()?
  3. What are display lists useful for?
  4. How do you allocate display list names?
  5. How do you create a display list?
  6. How do you invoke one display list? many display lists?
  7. Why might you want to create a hierarchical display list?

Return to top

Module 12 - Alpha Blending

Need to Cover

Lecture

Lab

Other

Notes

Only point and line antialiasing are really covered in this chapter, because in order to do polygon antialiasing correctly you need additional hardware bitplanes for destination alpha values. There are other ways to do polygon antialiasing using the accumulation buffer or multi-sampling.

Part of the antialiasing lab currently can only be done under IRIX. We don't yet have a Windows program that is the equivalent of mag or snoop.

Review Questions

  1. What is blending useful for?
  2. What is an alpha value, and how is it specified?
  3. How does blending work?
  4. What do you have to do to correctly render transparent objects in 3D? Why?
  5. What are the "jaggies"?
  6. What is antialiasing?
  7. How do you perform point and line antialiasing?

Return to top

Module 13 - Basic Texture Mapping

Need to Cover

Lecture

Lab

Notes

This is a long module. The first lab (material properties) provides a natural point for a break.

There is a texture tutorial in /usr/people/opengl/demos/GlutTutorials that can be run under either IRIX or Windows NT. The texture program demonstrates how OpenGL texture coordinates work. The texture parameters & environment attributes are tweakable. This tutorial is used in the first lab. You may also use it to illustrate the principles being discussed. It is recommended you spend some time getting comfortable with this tutorial before teaching.

When you run the texgen2 example, run texgen1 side by side with it for comparison.

Return to top

Module 14 - Text

Need to Cover

Lecture

Lab

Notes

This lab is optional. It can be taught if there is time or interest, or omitted if there is neither. Your students may prefer to spend more time on Texture Mapping.

You may tell the students that starting with IRIX 6.2 there is a new character rendering library available (GLC) for use with OpenGL. It is intended to be window system independent, and defines both bitmap and geometric fonts. This library provides for many more fonts than are available from the GLUT library. It is also more flexible. Unfortunately, this library is only available for IRIX.

Source is provided for an alternative version of the text 3D example program, in the file alt_text3D.c. This version uses a pseudo bitmap to position the text in screen coordinates. To build this version you need to edit the Makefile to remove the `#' that comments out alt_text3D in the CFILES and TARGETS macros.

Review Questions

  1. What types of fonts does GLUT support, and how do you use them?
  2. Why does the entire bitmap string get culled when the left edge goes off the screen, and how can you get around this?
  3. How can you create stationary text in a scene?
  4. How can you create labels that move in 3D?

Return to top


Detailed Changes Since OpenGL Programming Beta Release (3.7)

Overall

presentation

include

lib

answers

demos

labs

Intro

Windows

Rendering

Basic Transformations

Scene Modeling

Viewports

Depth Buffering

Animation

Viewing

Lighting

Improving Performance

Alpha Blending

Texture Mapping

Text

Appendix A: Using OpenGL in MS Visual Studio

Appendix B: OpenGL and Windows NT

Appendix C: Normal Calculation

Appendix D: Color Index Mode

Appendix E: Bibliography


Detailed Changes Since Last OpenGL Programming 1 Release (3.0)

See also Detailed Changes Since OpenGL Programming Beta Release (3.7).

Overall

presentation

include

lib

answers

demos

labs

Intro

Windows

Rendering

Basic Transformations

Scene Modeling

Viewports

Depth Buffering

Animation

Viewing

Lighting

Advanced Lighting

Improving Performance

Alpha Blending

Texture Mapping

Text

FAQ appendix

Appendix A: Using OpenGL in MS Visual Studio

Appendix B: OpenGL and Windows NT

Appendix C: Normal Calculation

Appendix D: Color Index Mode

Appendix E: Bibliography

Return to top