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
-
The instructor is assumed to be completely ramped on the OpenGL
Programming 1 course this replaces, plus basic texture mapping.
-
Read these notes, the README, and the release notes.
-
Install the instructor and student packages on your machine.
-
Read the student manual or go through the HTML presentation, including
the student notes under each "slide".
-
Perform all the student labs.
-
Familiarize yourself with the example and demo programs.
-
If you will be teaching the course on both IRIX and NT, familiarize
yourself with both build environments. Perform some of the labs on each
platform.
Recommended Reference Materials and Outside Reading
-
See OpenGL Documentation and Additional Resources
slides in Module 1 of the course, and the bibliography in Appendix E.
Publishing information on the books described below are in the
bibliography.
-
If you are new to 3D graphics, Interactive Computer Graphics: A
top-down approach with OpenGL is a good college-level textbook
that uses OpenGL to teach graphics principles.
-
The OpenGL Programmer's Guide (the "red book"), in
particular, is a wonderful resource. It has an excellent glossary, and
well-considered lists of tips on OpenGL correctness and performance.
-
To learn more about using OpenGL under IRIX, check out OpenGL
Programming for the X Window System (the "green
book").
-
To learn more about using OpenGL under Windows NT, check out one of
these:
-
OpenGL SuperBible : The Complete Guide to Opengl Programming
for Windows Nt and Windows 95
-
OpenGL Programming for Windows 95 and Windows NT
Return to top
-
All example, lab, and answer programs, and those demos that don't use
GLX (including the GlutTutorials), can be built and run on either IRIX
or Windows NT.
-
Programs compiled under IRIX 6.5 or 6.4 (Octane) may not run on earlier
OS versions without recompiling. In particular, the polygon offset and
vertex array examples use features only supported in OpenGL 1.1.
-
In classes with NT programmers, students may be confused that IRIX path
names use the forward slash "/" instead of the backslash
"\" used under Windows.
-
Also on NT, the programs will not build from the command line unless
the setupNT script is first run (see release notes). This
sets up environment variables needed by the compiler and linker.
-
Floating point constants are stored as doubles under Windows NT (at
least with our 32-bit build), which can generated thousands of warning
messages. Applying a "f" suffix to floating point constants
will appease the compiler.
-
Note: This Module 14: Rendering Text is optional. It may be
skipped in order to spend more time on textures.
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
-
The programs and Windows makefiles have been generally been cleaned up
to build without errors or excessive warnings.
-
Removed README.instructor since it was replaced by these HTML
instructor notes.
-
Switched the default login shell to csh.
-
At the bottom of this document is a detailed
list of the changes made in each module since OpenGL
Programming Beta version 3.7.
Changes from Prior Release to Beta
Release
This course replaces our previous OpenGL Programming 1 (OGL1) and
OpenGL Programming 2 (OGL2) sequence.
-
The content is basically:
-
a revision of OpenGL Programming 1
-
a new Texture Mapping module created from excerpts of OpenGL
Programming 2's two texture modules plus some new material
-
added support for Windows NT
-
In order to make room for textures:
-
the two lighting modules have been combined into one
-
some lighting material has been removed
-
the blending module has been shortened
-
All OpenGL version 1.0 material has been updated to version 1.1. There
are a few notes about features coming in 1.2, and the polygon offset
and vertex array programs are backwards-compatible with 1.0. That is,
the programs are ifdef'd to provide both 1.0 extension and 1.1 feature
support.
-
The IDBs no longer install the program executables, so a full build
must be done after installation. This can be done by the intern as part
of the software verification, or as part of the first lab (which
includes instructions for building on both IRIX and NT).
-
At the bottom of this document is a detailed
list of the changes made in each module since OpenGL
Programming 1 version 3.0.
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
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
-
To submit bugs, select OpenGL Programming from the GCE Bug Entry
form. Start the summary line with OGL_4.0_6.5 (the course
code).
-
For a list of currently open bugs, click
here or select OpenGL Programming from the GCE Bug Query
form. Only two low priority bugs were known at the time of release.
Return to top
Module by Module Notes
Module 1 - Introduction
Need to Cover
-
Introduction lecture
-
Introduction lab
Lecture
-
The lecture should take about 45 minutes.
Lab
-
The lab should take about 20 minutes.
-
The lab is intended to get the student lab directory set up, whether
under Windows NT or IRIX.
Other
-
Allow at least 30 minutes for introductions at the beginning of the
course.
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
-
Discuss the notion that the OpenGL is a state machine for rendering. It
doesn't perform any windowing functions.
-
What are some of the OpenGL libraries?
-
OpenGL (GL)
-
OpenGL Utility (GLU)
-
OpenGL Utility Toolkit (GLUT)
-
X extensions for OpenGL (GLX)
-
OpenGL extensions for Microsoft Windows (WGL)
Return to top
Module 2 - Windows
Need to Cover
-
Windows lecture
-
Windows lab
Lecture
-
The lecture should take about 45 minutes.
Lab
-
The lab should take about 20 minutes.
-
Students who want to use the Visual C++ development environment under
NT will need longer to get the project set up.
Review Questions
-
How do you create a window using GLUT?
-
initialize glut using glutInit()
-
set the initial position using glutInitWindowPosition() (optional)
-
set the initial size using glutInitWindowSize() (optional)
-
set the display mode using glutInitDisplayMode()
-
create the window using glutCreateWindow()
-
set the display function using glutDisplayFunc() (required in GLUT 3.0)
-
enter the main event loop using glutMainLoop()
-
What is the default display mode?
-
single buffered, RGBA, depth
-
How do you clear the window?
-
set the clear color with glClearColor()
-
call glClear() with GL_COLOR_BUFFER_BIT set
-
What is the default clear color?
-
What is the difference between glFlush() and glFinish()?
-
glFlush() makes sure that all of the GL commands up to that point have
been sent to the graphic hardware
-
glFinish() waits until the graphics hardware sends back a signal to
indicate that it has actually displayed all of the GL commands up to
the point at which it was called.
-
How are errors handled in OpenGL?
-
you have to poll for errors using glGetError()
-
How do you get keyboard input using GLUT?
-
set up a callback to handle keyboard input using glutKeyboardFunc()
-
How do you force GLUT to redisplay your scene after you have made some
changes?
Return to top
Module 3 - Rendering
Need to Cover
-
Rendering lecture
-
Rendering lab
-
Rendering and the Shading Model lab
Lecture
-
The lecture should take about 60 minutes.
Lab
-
The lab should take about 30 minutes.
-
The second lab should take about 30 minutes.
Review Questions
-
What is rendering?
-
What is a vertex, how is it represented, and how is one specified?
-
a point in space
-
vertices are always represented as homogeneous coordinates
-
vertices are specified using some form of glVertex*()
-
What are world coordinates?
-
the imaginary coordinate system in which you create your models
-
What is the viewing volume and how is it defined?
-
the part of the world that is rendered
-
glOrtho()
-
Name the three types of geometric primitives. How are they created?
-
points, lines and polygons
-
glBegin()/glEnd()
-
What is modeling?
-
creating complex objects using primitives
-
What is a convex polygon?
-
a polygon that lies in one plane and doesn't intersect itself
-
How many faces does a polygon have, and which one is in front?
-
two: front and back
-
by default, the front face is the one with counterclockwise
orientation, relative to the eye
-
Name the shading models, and describe them. Which is the default?
-
flat shading renders polygons all in one color
-
smooth shading interpolates colors between vertices; this is the default
Return to top
Module 4 - Basic Transformations
Need to Cover
-
Basic Transformations lecture
-
Modeling Transformations Exercise
-
Modeling Transformations Exercise
-
Modeling and Projection Transformations lab
Lecture
-
The lecture should take about 60 minutes.
Lab
-
The lab should take about 30 minutes.
Other
-
Allow at least 15 minutes for each of the transformation and projection
exercises.
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
-
What are the three transformations, and how are they similar to the
camera analogy?
-
projection transformations define the viewing volume; this is similar
to choosing the type of lens
-
modeling transformations position the objects in your world; this is
similar to moving the objects that you are going to take a picture of
-
viewing transformations position the eye; this is similar to moving the
camera position and orientation
-
What are the modeling transformations?
-
glRotate(), glTranslate(), glScale()
-
What are the projection transformations? (briefly describe each)
-
glOrtho() creates an orthographic projection which models parallel rays
of light; objects are projected to the screen by making them uniformly
flat
-
gluPerspective() and glFrustum() create perspective projections;
objects that are closer to the viewpoint appear larger than objects in
the distance; glFrustum() can be used to create an asymmetric
perspective projection in which the line of sight isn't down the middle
-
Why are matrices important?
-
all transformations are represented by matrices which are used to
transform vertices
-
Name the matrix stacks discussed in this module.
-
How do you save and restore items on the matrix stack?
-
glPushMatrix(), glPopMatrix()
Return to top
Module 5 - Scene Modeling
Need to Cover
-
Scene Modeling lecture
-
Solar System Matrix Stack Exercise
-
Scene Modeling lab
-
Bicycle Matrix Stack Exercise (optional)
Lecture
-
The lecture should take about 45 minutes.
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.
-
The basic lab should take about 30 minutes.
Other
-
Allow at least 15 minutes for the students to work through the solar
system matrix stack exercise. Review it when they are done.
-
The bike matrix stack exercise is optional. It should take another
15-30 minutes.
Notes
There are solutions to the exercises, and extra worksheets in the back
of the module in the student manual.
Review Questions
-
Why is transformation order important?
-
Because each transformation is represented by a matrix, and the
matrices are post-multiplied together. Matrix multiplication is
generally not commutative.
-
Use the "Effects of Transformation Order" slide to quiz the
students on what happens for particular orderings (or have the students
quiz each other). Tell the students not to look at this chart while
they are being quizzed.
-
How can you apply independent transformations for different objects in
your scene?
-
use the matrix stack to push a set of transformations, and then pop
them off when you are done
Return to top
Module 6 - Viewports
Need to Cover
-
Viewports lecture
-
Viewports lab
Lecture
-
The lecture should take about 30 minutes.
Lab
-
The lab should take about 15 minutes.
Review Questions
-
What is a viewport?
-
the part of the window you render into
-
What happens if the aspect ratio of your viewport doesn't match the
aspect ratio of your viewing volume?
-
object shapes are distorted
-
How do you reset the viewing volume when the window is resized?
-
set up a reshape callback that does the following:
-
switch to the projection matrix stack
-
use glLoadIdentity() to set the top of the stack to the identity matrix
-
set your projection
-
switch back to the modelview stack
Return to top
Module 7 - Depth Buffering
Need to Cover
-
Depth buffer lecture
-
Depth buffer lab
Lecture
-
The lecture should take about 45 minutes.
Lab
-
The lab should take about 30 minutes.
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
-
What is the painter's algorithm, and what are its limitations?
-
draw objects in back to front order
-
doesn't properly handle objects that intersect, and you need to keep
changing the order if you change the viewpoint
-
How do you request a depth buffer, how do you clear it, and how do you
enable depth buffer testing?
-
specify GLUT_DEPTH when setting the display mode
-
specify GL_DEPTH_BUFFER_BIT when clearing the window
-
use glEnable() with GL_DEPTH_TEST
-
Why was polygon offset introduced?
-
because polygons and lines rasterize differently, making it difficult
to draw outline polygons
-
What does the polygon offset feature do?
-
it allows you to specify an offset for depth values
-
it displaces fragments' depth values by the offset
-
useful for rendering lines over surfaces, and applying decals to
surfaces
-
What does glCullFace() do?
-
specifies which faces to remove when removing hidden surfaces
-
by default, back facing polygons (polygons with clockwise orientation
relative to the eye) are culled when GL_CULL_FACE is enabled; this can
be changed using glCullFace()
Return to top
Module 8 - Animation
Need to Cover
-
Animation lecture
-
Animation lab
Lecture
-
The lecture should take about 30 minutes.
Lab
-
The lab should take about 30 minutes.
Review Questions
-
How do you animate your program using GLUT?
-
specify an "idle" callback that gets called when no other
window system events are pending
-
What causes flicker, and how does double buffering solve this problem?
-
when in single buffer mode, you see the intermediate stages of drawing,
including the clear, which creates a "flicker"
-
with double buffering, you render everything to a buffer that is not
visible (the "back" buffer), and then when the scene is
ready, you draw it to the monitor all at once
-
Why do double buffered programs appear to run slower?
-
because the buffers can only be swapped during a vertical retrace
-
How do you make sure that your program doesn't waste CPU cycles when
your program isn't visible?
-
set up a visibility callback and disable animation when the state is
GLUT_NOT_VISIBLE
-
How do you create a menu using GLUT?
-
create the menu using glutCreateMenu()
-
add entries using glutAddMenuEntry()
-
attach the menu to a button using glutAttachMenu()
-
When might you want to change a menu entry?
-
when the options change, because the state of the program has changed.
For example, you may have an entry labeled "Enable
animation". Once the animation is enabled, you might want to
change the entry to "Disable animation".
Return to top
Module 9 - Viewing
Need to Cover
-
Viewing lecture
-
Viewing Transformations exercise
-
Viewing lab
Lecture
-
The lecture should take about 45 minutes.
Lab
-
The lab should take about 45 minutes.
Other
-
Allow at least 15 minutes for each of the viewing transformations
exercises
-
You might also have the students run ~/demos/polarViewDemo.
Review Questions
-
What is the default orientation of the camera (eye)?
-
at the origin, looking down the -z axis
-
When might you use gluLookAt()?
-
when panning across a scene, or zooming in on different objects in a
scene
-
When might you use polarView()?
-
when looking at an object from all angles
-
How do you tell GLUT you want to get mouse input?
-
specify a callback for mouse events and motion events
-
What is unusual about the y value passed to your mouse callback (when
using the X window system)?
-
it is relative to the upper left corner of the window, rather than the
lower left corner (which is how y values are specified in OpenGL)
Return to top
Module 10 - Lighting
Need to Cover
-
Lighting lecture
-
Materials lab
-
Lighting lab
Lecture
-
The lecture should take about 90 minutes.
Lab
-
The labs should take about 45 minutes each; 90 total.
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
-
What do you have to do to light an object?
-
specify normals
-
specify material properties (not strictly necessary)
-
turn on lighting
-
turn on a light
-
What is a normal, and how are normals specified?
-
a normal is a vector that specifies which direction the face of an
object is pointing
-
normals are specified using some form of glNormal*()
-
What is a normalized normal, and how do you create one?
-
a normal with a unit length of one
-
divide the normal vector by the length of the normal
-
What are material properties used for?
-
to define the "material" for a lit object
-
Describe each of the material properties that can be set.
-
Diffuse reflection is the "base" color of the object; that
is, the color of the object when a white light is shining directly at
it
-
Ambient reflection is the color of the object where light is not
shining directly on it
-
Specular reflection is the color of the highlights
-
Shininess specifies how smooth the material is; it affects how big the
specular highlight is
-
Emission is the color of the light emitted by an object
-
What optimization can you make if you are setting the same property for
many different objects?
-
enable GL_COLOR_MATERIAL and use glColor*() to change the material
specified by glColorMaterial()
-
How do you set light source properties?
-
Describe the ambient, diffuse and specular light intensity properties.
-
ambient intensity simulates the intensity of a light after it has been
scattered by the environment
-
diffuse intensity specifies the color of the light when it hits an
object directly along the object's normal
-
specular intensity affects the color of the specular highlight
-
How do you create a light that moves with the eye?
-
bind the light before setting your viewing transformation
-
How do you create a light that stays fixed in the scene?
-
bind the light after setting your viewing transformation
-
How do you create an animated light?
-
give the light its own modeling transformations
-
How do you create objects that have different materials on the inside
and outside?
-
use glMaterial() to set different material properties for the front and
back faces
-
enable a two sided lighting model
Return to top
Module 11 - Improving Performance
Need to Cover
-
Performance lecture
-
Performance lab
Lecture
-
The lecture should take about 75 minutes.
Lab
-
The lab should take about 45 minutes.
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
-
What are vertex arrays useful for?
-
performance! they can reduce the overhead of multiple function calls to
define vertices, normals, colors, etc.
-
data from model files can be used in its packed format
-
What is the difference between glDrawArrays() and glDrawElements()?
-
glDrawArrays() renders the array data sequentially
-
glDrawElements()renders the array data in index order
-
What are display lists useful for?
-
performance! they can reduce the amount of network traffic, and the
implementation can optimize things like matrix transformations
-
the same object can be reused without having to redefine it
-
creating 3D text
-
How do you allocate display list names?
-
How do you create a display list?
-
make OpenGL calls between glNewList() and glEndList()
-
How do you invoke one display list? many display lists?
-
invoke a single display list with glCallList() and a single display
list name
-
invoke multiple display lists with glCallLists() and an array of
display list names
-
Why might you want to create a hierarchical display list?
-
to reuse objects that are defined in display lists; for example, you
only need to define the wheel of a car once, and call it four times
within the "car" display list
-
to be able to change parts of a display list on the fly
("edit"); this is particularly useful for changing things
like materials
Return to top
Module 12 - Alpha Blending
Need to Cover
-
Alpha Blending lecture
-
Antialiasing exercise
-
Alpha Blending lab
Lecture
-
The lecture should take about 60 minutes.
Lab
-
The lab should take about 45 minutes.
Other
-
Allow at least 15 minutes for the antialiasing exercise.
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
-
What is blending useful for?
-
transparency, painting, digital compositing, and much more
-
What is an alpha value, and how is it specified?
-
the alpha value specifies how see-through an object is; it is specified
using the GL_DIFFUSE material property if lighting is enabled,
otherwise with glColor4*()
-
How does blending work?
-
specify alpha values for your objects
-
specify a blending function the defines how the alpha values are used
-
enable blending
-
What do you have to do to correctly render transparent objects in 3D?
Why?
-
draw the opaque objects first so that the transparent objects will
blend with them
-
draw the transparent objects from back to front with depth buffer
writing disabled so the transparent objects are ordered correctly
relative to each other
-
What are the "jaggies"?
-
the stairstep edges that objects get when angled lines and edges are
rendered with square pixels
-
What is antialiasing?
-
the process of getting rid of the jaggies; the edges of objects are
blended with their surroundings based on a coverage value to fake the
eye into seeing a smoother edge
-
How do you perform point and line antialiasing?
-
specify the blend function as
-
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA)
-
or for brighter line intersections, use
-
glBlendFunc(GL_SRC_ALPHA, GL_ONE)
-
draw background with no alpha value
-
draw antialiased objects from back to front so that they blend with the
correct background colors
Return to top
Module 13 - Basic Texture Mapping
Need to Cover
-
Texture mapping lecture
-
Texture mapping lab
Lecture
-
The lecture should take about 90 minutes.
Lab
-
The labs should take about 90 minutes.
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
-
The lecture should take about 30 minutes.
Lab
-
The lab should take about 30 minutes.
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
-
What types of fonts does GLUT support, and how do you use them?
-
bitmap fonts that are created from X fonts; set the raster position
before calling glutBitmapCharacter() for each character to be rendered
-
stroke fonts that are created from geometric primitives; specify
modeling transformations before calling glutStrokeCharacter() for each
character to be rendered
-
Why does the entire bitmap string get culled when the left edge goes
off the screen, and how can you get around this?
-
because the bitmap is treated as a point located at the current raster
position, and so the whole string is culled when the raster position
goes outside the viewing volume
-
to get around this, you can specify the viewport so that it is larger
than the window by the length of the string; however, you may need to
adjust the aspect ratios accordingly.
-
How can you create stationary text in a scene?
-
use an orthographic projection that maps window coordinates to world
coordinates
-
How can you create labels that move in 3D?
-
use a perspective projection with stroke fonts
Return to top
Overall
-
The Visual C++ project files provided with the Beta release have been
replaced with simple Makefile.win files that can build the entire tree
from the top.
-
Both debug and non-debug builds are supported. The default is non-debug
for everything except the labs directory.
-
Replaced all references to OpenGL Programming 1, opengl1, or OGL1 with
appropriate substitutes.
-
All source files that use oglprog functions now include the appropriate
headers. This cleaned up a lot of compiler warnings under Windows NT.
-
Applied "f" suffix to floating point constants to appease NT
compiler. Floating point constants are stored as doubles under WIN32,
which generated thousands of warning messages.
-
Updated code examples in presentation to match the changes in programs,
with two exceptions: the "f" suffix mentioned above, and the
new header files.
-
Replaced use of file random.h in examples to inclusion of the macro
definition. Noted the header is there for students who want to use it
in labs.
-
Decreased size of indents in presentation's example code.
presentation
include
-
Supplied header files for those oglprog source files that didn't have
them.
-
New headers are shapes.h, misc.h
-
Renamed error.h to checkError.h to fix name conflict under NT.
lib
-
Each source file now includes its own header.
answers
-
Updated names/numbers of solar answer programs to reflect new order of
modules.
-
Renamed sample answer lists.c to performance.c, adding a vertex array
example to it.
-
Removed sample answers from labs that have been removed.
-
Modified answer programs to reflect the new order in which features are
added.
demos
-
Created a Windows makefile for all non-GLX demo programs.
-
Ifdef'd blend equation code in modeler.c (not available on NT).
labs
-
All lab source files now include their own headers.
Intro
-
-
1-7 The OpenGL Library -- Added more detail to the list of OpenGL
functions.
-
1-8 Clarified types of polygons GLU can handle.
-
1-12 Name Conventions -- Updated the IRIX link line in the Student
Notes.
-
1-19 Removed obsolete OpenGL extensions URL from Notes.
-
1-21 OpenGL Documentation -- Added a link to the Bibliography. Reworded
paragraph on OpenGL Porting Guide in the Student Notes.
-
1-22 Additional Resources -- Added Microsoft OpenGL documentation URL
to Student Notes.
-
1-23 Class Directory Structure -- Slightly reworded Student Note about
~opengl and removed breaks between the two bullets so it will fit on 1
printed page.
-
1-24 Lab: Getting Started -- Added on to the lab to include building
the source tree and the lab program.
Windows
-
2-24 Example: input.c -- Updated the code for changes in the program.
Added a note about random.h to the Student Notes.
Rendering
Basic Transformations
Scene Modeling
Viewports
Depth Buffering
-
7-4 A Problem With the Painter's Algorithm -- New images are larger and
have better color contrast for print. Aligned them to the right so
everything fits.
-
7-14 glPolygonOffset -- Added comment on polygon offset enable modes to
Student Notes.
Animation
Viewing
-
Added a twist option to polarview.c.
-
mouse.c: Added shift-left button as an alternative to the middle mouse
button for systems that only have a two button mouse (such as most
PCs).
Lighting
-
10-9 Added information on rescaling normals (OpenGL 1.2 feature) as an
alternative to automatic normalization.
-
10-17, 10-34 Split the lab in two, so there is a lab in the middle of
the module.
-
material.c: New sample answer for the first lab.
-
10-31 The Lighting Equation -- Corrected lighting equation diagram.
Improving Performance
-
11-9 Added #ifdef's with vertex array extension code for pre-OpenGL-1.1
systems.
Alpha Blending
Texture Mapping
-
13-4 read_texture() -- Corrected "internalformat" to
"components." Added a Student Note on reading Windows .bmp
files.
-
13-6 What is Texture Mapping? -- Corrected "gluTexParameter"
to "glTexParameter." Removed "You really only have to do
steps 1 and 3" from Student Notes.
-
13-13 Specifying Filters -- Clarified second paragraph in Student
Notes.
-
13-17, 13-35 Split the lab in two, so there is a lab in the middle of
the module.
-
texture.c: New sample answer for the first lab.
-
All programs: Removed #ifdefs with different file paths to texture
files for WIN32. No longer needed.
-
texgen1.c, texgen2.c: Changed internal format to GL_RGBA for building
mipmaps.
Text
-
14-2 GLUT Font Rendering -- Added Student Notes on IRIX and
Windows-specific font functions.
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
See also Detailed Changes Since OpenGL
Programming Beta Release (3.7).
Overall
presentation
-
Converted to HTML. Now installed in ~/public_html/presentation.
-
Converted module Overview slides into Objectives.
-
Fixed typos.
-
Added an instructor bookmarks file.
include
-
Replaced OGL2's rgbImageFile.h with texture.h for cross-platform read_texture
function.
lib
-
Replaced OGL2's rgbReadImageFile.c with texture.c for cross-platform read_texture
function.
answers
-
Added solar15.c, which applies a texture to the earth.
-
Updated polygonoffset.c for OpenGL 1.1. Ifdefs allow it to still work
with OpenGL 1.0, but it will require recompiling.
-
Replaced all popup menus with key press.
demos
-
The projection and transformation tutorials have been replaced, and new
tutorials for light position, light materials, and textures added.
These are GLUT programs that can be run under IRIX or Windows NT. They
are found in ~/demos/GlutTutorials, including source.
-
The remaining Motif tutorial, ortho2D, is now in
~/demos/MotifTutorials,.
labs
-
Added some texture files.
Intro
-
Added course objectives slide.
-
Reorganized to present OpenGL material in this order: architecture,
syntax, data types.
-
Removed prerequisite slide, obsolete courses.
-
Updated mailing lists, URLs, and references.
-
Added cross-platform information on Windows NT/WGL.
-
Added OpenGL version information slide.
-
Removed Support for OpenGL on SGI workstations.
Windows
-
Added slide of the 3 requirements for interfacing OpenGL to the native
windowing system (X or Windows).
-
Added a slide on why we use GLUT (so we can focus on OpenGL).
-
Also clarified slide on number of available colors by explaining
"bitplane".
-
Combined and updated bitmask tables on Configuring a Window slide.
Rendering
-
Combined Connected and Closed Lines slides, and Triangle Fans and
Strips.
-
TO DO: probably should add vertex arrays.
Basic Transformations
-
Added a slide with diagrams of right-handed coordinate system.
Scene Modeling
-
Images and sample solutions for modeling lab were updated for the new
tutorial.
Viewports
Depth Buffering
-
Updated polygon offset slides and program from OpenGL 1.0 extension to
OpenGL 1.1 core feature.
-
Noted that lab exercise may not show a visible effect.
Animation
-
Removed popup menu slides and example program.
-
Changed lab instruction to add a key to toggle, instead of popup menu.
-
Moved Animation after Depth Buffering and before Viewing.
-
smooth_arm.c -- Moved window to the right so it can be run side-by-side
with flicker_arm.c
Viewing
-
Images and sample solutions for projection transformation lab were
updated for the new tutorials.
-
polarView.c -- added keyboard toggles t/T to change the twist
Lighting
-
Renamed Lighting Basics to Lighting.
-
Added light position and moving light from OGL1 Advanced Lighting
module.
-
Deleted slide explaining RGB color.
-
Split the Lighting lab into two to provide a natural break point for
long module.
-
Added use of cross-platform lighting tutorials.
-
blend_equations.c, spotlightalpha.c -- Removed.
-
movingLight.c -- Added viewer model toggle and replaced cube with
sphere.
-
lightIntensity.c -- Added printfs when lighting properties change.
-
Moved normal calculations to an appendix.
-
Corrected font on glNormal3f prototype - removed italics from the
GLfloats.
Advanced Lighting
-
Removed. Later modules need to be renumbered.
-
Some of the material has been added to Basic Lighting.
-
Color index mode section has become an appendix.
Improving Performance
-
Renamed Display Lists to Improving Performance.
-
Added slides, example program, and optional lab step on vertex arrays.
Alpha Blending
-
Removed blend equation extensions, logical operations, alpha lighting.
-
Cleaned up some of the equations.
-
Combined tables of blend functions.
Texture Mapping
-
New; derived from OGL2 modules.
-
Removed borders material, and example.
-
Removed swim.c example.
-
Added toggles for alpha test and blending to texenv.c.
-
Added texture objects.
-
Updated all programs to use cross-platform read_texture
function to load images.
-
Added automatic texture coordinate generation and GLU quadric
objects/texture.
-
Wrote two labs; one using new tutorial and providing a natural break
point.
Text
-
Moved Text to the end.
-
Changed string from "OpenGL Programming" to
"OpenGL" in text examples as a workaround to a rendering bug
(only see first word).
FAQ appendix
-
Removed. Will provide a URL if the ARB's FAQ is updated in time.
Appendix A: Using OpenGL in MS Visual Studio
Appendix B: OpenGL and Windows NT
-
New, article reprinted from Developer News.
Appendix C: Normal Calculation
-
New, extracted from OGL1 Basic Lighting module.
Appendix D: Color Index Mode
-
New, extracted from OGL1 Advanced Lighting module.
Appendix E: Bibliography
-
Added Procedural Elements for Computer Graphics.
-
Updated information.
Return to top