Steve Cunningham
Projects for a Computer Graphics California State University Stanislaus
Programming Course San Diego Supercomputer Center
[email protected] One of the key points in creating an effective computer science course Project 1: Identify some appropriate geometry to be displayed using
is developing the projects students will do in the course. This paper the API that supports the course. This requires proper initialization of
describes a set of projects for a computer graphics programming the API, definition of the viewing environment, analysis of the geometry
course, with a particular focus on projects whose content is in the area into appropriate primitives and use of simple instancing transforma -
of visualization in the sciences. 1 This focus serves a well-defined group tions, use of geometric primitives to display the geometric primitives,
of students whose needs have long been a concern to the SIGGRAPH use of hidden-surface display, and use of color as needed for the
community5 and can also make the course a key factor in a computa- geometry. A technique such as the OpenGL idle callback can be used
tional science program. The projects are intended to allow the course to create some motion, even in this first project.
to be both an effective service course for science students and a sound
introduction to computer graphics for computer science students. Project 2: Use the same or different geometry, but increase the
sophistication of the rendering by adding shading and lights to
The Cou r s e the scene, illustrating ambient, diffuse, and specular lighting. Use
As described elsewhere, 2,3 the author believes that developments in multiple lights, colored lights, or spotlights to illustrate the effects
graphics hardware and APIs allow creation of a new paradigm for the they can create.
introductory computer graphics course. This course can now focus on
graphical thinking, problem-solving, and communication as expressed Project 3: Use the same or different geometry, but focus on simple
through a high-level API, and it can provide an excellent background to interaction with the scene, adding keyboard, menu, and mouse call-
students who would want to use computer graphics in their profes- backs and controls for the scene. If tools are available (such as the
sional work. This new course is a half-year course that serves as both a MUI system for OpenGL) add button or slider controls as appropriate.
service course for many other programs on a university campus and as The approach to this project will depend on the amount of UI focus
an entry point for students who want to study computer graphics more the instructor wants to have in the course, but this could be significant.
deeply. Its only requirements are programming skills (as expressed by
successful completion of the equivalent of the CS1 and CS2 sequence) Project 4: Use the same or different geometry and add more features
and an ability to think geometrically and spatially in the student’s field. of modeling and/or rendering, including hierarchical modeling, clipping
planes, alpha blending, fog, or texture mapping. This is a good place to
One of the key issues in creating any successful computing course, discuss genuine 3D viewing with stereo pairs or Chromadepth color
and one that often is overlooked in the literature on teaching computer encoding,6 and this is very interesting to students. While it is tempting
56 to use techniques for their own sake, this might be a good project to
graphics, is the projects students will do in the course. This is espe-
cially true of a course that offers significant content to non-computer- leave fairly open-ended to allow the student to choose (and justify)
science majors, because the projects are the students’primary tool the techniques to be used to create a particular communication.
to encounter the subject matter.
Project 5: A more advanced, “capstone” project would ask the
Project Concepts for the Cou r s e student to use additional techniques noted in Project 4 that were not
used there, as well as new techniques, such as evaluators to generate
The author suggests that a half-year course would include five program-
spline surfaces or object selection to allow students to expand their
ming projects. These projects are intended to develop from simple geo-
interactions with images. Again, this project could be built on the same
metric thinking to more significant applications of the tools in the API.
or different geometry as earlier projects, as appropriate.
Note that these projects do not identify the API being used; it should be
possible to do them with any of the current APIs that might be used in
the course. To begin, let us outline the projects in very general terms,
focusing on the topics to be considered without specific applications
(these will follow in the subsequent section on science applications).
C o n f e rence Abstracts and Applications
E duc ators Pr o g r a m
Some Specific Projects Project 2
The programming approach to the computer graphics course with • Mathematics. Add shading and lights to the surface viewing.
science-focused projects offers an excellent opportunity to create a This project could also focus on higher-dimensional or parametric
course that has unique value to students outside computer science. surfaces, generalizing the first project.
In particular, focusing on science topics can make this course effective • Chemistry. Add shading and lights to the molecular image,
for science students or, especially, computational science programs. showing the atoms with appropriate highlights.
This section describes some such projects and gives examples of the
• Physics. Display a function defined as the sum of two linear
kinds of images each could create. Restricted space limits the number
or circular wave functions, with ambient, diffuse, and specular
of projects that can be described here, so we describe only projects for
lighting. Use the simple animation of the first project to show
mathematics, chemistry, and physics. All of these projects, as well as
the behavior of the wave functions over time.
others, are described in more depth in the online materials noted at the
end of this paper.
Project 3
• Mathematics. Add keyboard control for rotations, clipping, or
Project 1
other mathematical operations. This would include discussions
• Mathematics. Display a surface defined by a function of two
of the kinds of interaction or control appropriate for mathematical
variables. This requires creation of a grid in the domain and
operations. Add other kinds of control for parameters if the surface
corresponding points in 3-space in the surface, displaying the
is defined as a parametric function.
triangles derived from the domain grid, and coloring the surface
in some way such as height. • Chemistry. Add keyboard-controlled rotations and menu selections
to the molecular display. This would allow discussions of the kind
• Chemistry. Read a standard molecule description file and create
of control appropriate for viewing objects in space. Because of the
a display of the molecule with standard atom-coded colors. This
time it might take to display fairly complex molecules, the third
requires the use of simple transformations to place the atoms,
project should also add display lists to improve performance on
using pre-written functions to read molecular description files.
the display.
• Physics. Display a rectangular bar divided into a grid, with
• Physics or Chemistry. Create a simulation of molecules moving
some grid areas held at constant hot or cold temperatures
randomly in a cube, and periodically report the number of times
and with temperatures changing by a diffusion process. Because
a molecule strikes the side of the cube in a step of the simulation. 57
temperature can be encoded through either geometry or color,
This value simulates pressure, and allows the student to test
this project offers the opportunity to discuss ways to encode
the gas laws: the pressure varies linearly with the number of
information in a graphics environment.
molecules present and inversely with the volume of the cube.
(b) A stereo pair of conic sections that the reader
Figure 1: (a) A mathematical surface with light and materials
can resolve without external aid. (Project 4).
modeling (Project 2).
C o n f e rence Abstracts and Applications
E duc ators Pr o g r a m
Projects for a Computer Graphics
Programming Course
Have the student track the motion of one molecule to see the Project 5
nature of Brownian motion, allow rotations of the space so • Mathematics. Display a spline surface with user-selectable,
the user can see the entire space, and add controls that change movable control points. This requires students to manage
the number of molecules present or the volume of the space to both evaluators and object selection and to deal with moving
allow the user to test the simulation. objects in 3D.
• Chemistry. Add selection of an individual atom so that the
Project 4 atom can be manipulated or information on it can be returned.
• Mathematics. Create a display showing the quadratic cur ves Alternately, the project could display vibration modes for
as actual conic sections, using menus and other controls for a selected molecule component using vibration information
managing the clipping planes that create the sections and creating provided separately.
coordinated stereo pairs to see the conic sections in 3D.
• Physics. Create a simulation of a multiple-body problem with
• Chemistry. Add transparency and alternative views of the molecule. simple numerical integration and build a time-based animation
The alternative views could add a clipping plane with keyboard of the situation. Use simple controls to allow the user to move
control of a front-and-back motion on the plane, Chromadepth around in the animation space, and use Chromadepth or stereo
texture mapping to create real 3D viewing, stereo pairs, or pairs to allow the user to experience the animation in real 3D
texture-map information onto individual atoms, though this space. Add selection to allow the user to identify an individual
may be very slow on some machines. body and to use interaction techniques to provide real-time
• Physics. Create a display of a function of three variables with steering of the simulation by changing the velocity or direction
a physical basis, such as temperature, static force, or gravity of the moving body.
in some spatial region. This could be an implicit surface or a
color-coded display of function values in a clipping plane in These figures illustrate some of the projects described abo ve. The
the region. Allow the user to interact with the display to move figures start with mathematics projects, then mo ve to chemistry,
the implicit surface or clipping plane, and have the project and then to physics, and the captions identify which project is being
include some conclusions about the nature of the function. illustrated. Note that some of the projects, especially Projects 3 and 5,
do not lend themselves well to figures because their focus is an action,
not an image.
58
Figure 2: (a) Simulation of the gas laws with (b) An image of a molecule with Chromadepth coloring
sample text output from a query (P roject 1). added (Helvetane) (Project 4).
C o n f e rence Abstracts and Applications
E duc ators Pr o g r a m
C o nc l u s i o n s and other pages linked from there, and the final results will eventually
This approach to the beginning graphics course is oriented toward be available at the online SIGGRAPH and Eurographics sites and at
the science student and fits the growing use of visualization in the appropriate courseware repositories.
sciences, but it should be possible to focus the projects towards many
other fields to support visualization in these fields. Versions of this References
1. Brown, J., Cunningham, S., & McGrath, M. (1990). Visualization in science and
course have been taught twice (at two different universities) with signif-
engineering education. In G. M. Nielson & B. Shriver (Eds.), IEEE Tutorial:
icant student interest and success, although it has so far been difficult Scientific Visualization. IEEE Computer Society.
to reach significant numbers of science students. Some stability in the 2. Cunningham, S. (2000, February) Re-inventing the introductory computer
course content and some marketing of the course to the sciences are graphics course: Providing tools for a wider audience. Computers & Graphics.
needed to increase interest. Conversations about and presentations of 3. Cunningham, S. (2000). Powers of 10: The case for changing the first course
this course to a number of people in computer science, computational in computer graphics. Proceedings of the SIGCSE 2000 Technical Symposium
on Computer Science Education.
science, and the sciences lead the author to believe that this approach
4. Reports of the Graphics & Visualization 99 Workshop are to appear in
is worth sharing with the graphics community in spite of the relative Computer Graphics and Computer Graphics Forum and are available online
lack of experience, because other fields are eager to gain the advan- at www.eg.org/WorkingGroups/GVE/GVE99 and www.education.siggraph.org/
tages of learning about graphics without having to master fundamental conferences/GVE99/.
graphics principles and without having to rely on pre-written graphics 5. Domik, G. Report on visualization curriculum. www.uni-paderborn.de/
fachbereich/AG/agdomik/visualisierung/vis-report/
applications.
6. Chromadepth glasses and other information are available from Chromatek Inc:
www.chromatek.com/
The project materials described here are being developed with
funding from the National Science Foundation. These materials include
Credits
descriptions of projects for each of the sciences, source code for the This work is partially supported by National Science Foundation grant DUE-9950121.
examples, supplements on various graphics topics, and pointers to All opinions, findings, conclusions, and recommendations in this work are those of
example materials from various sources. As additional materials ar e the author and do not necessarily reflect the views of the National Science Foundation.
The author would also like to thank the San Diego Supercomputer Center for supporting
developed, they will be available at www.cs.csustan.edu/~rsc/NSF/ this work.
59
Figure 3: (a) A heat simulation in a bar (Project 1). (b) An N-body simulation (Project 5).
C o n f e rence Abstracts and Applications
E duc ators Pr o g r a m