Document Actions


by WebSysAdmin last modified 2006-09-02 16:41

Interactive Teaching Modules for Computer Graphics


Welcome to the Interactive Teaching Modules for Computer Graphics,
developed under the supervision of Dr. Avi C. Naiman, in the Department
of Computer Science, Hong Kong University of Science & Technology.

Copyright 1995&1996 HKUST; All Rights Reserved.

For assistance, please send email to

I would appreciate hearing from you if you use this system and what
parts you found useful. While I cannot guarantee a timetable on any
further developments for the package, I welcome suggestions for
improvements and I am eager to hear about new modules created with this


We have been developing a suite of interactive modules for teaching
Introductory Computer Graphics, using a library we have built to
support such efforts. The modules provide explanations of fundamental
concepts, tutorial demonstrations of basic techniques, and interactive
control of the parameters used in and execution of high-level
representations of elementary algorithms. The primary benefit to
students is that, rather than learning from strictly textual material
(perhaps supplemented with static imagery), they are exposed to dynamic
tutorials of the concepts, which is essential for the comprehension of
many visual phenomena. The interactive nature of the modules allows
students to explore concepts at their own pace and focus on areas of
particular interest; the dynamic nature of the modules increases
student interest, attention and comprehension.

This software package contains two components: 1) specific interactive
modules that have been developed for teaching various concepts in
computer graphics; 2) a library of software routines to aid in further
development of these or other modules (whether in computer graphics or
other disciplines), as well as demonstration usages of the library
routines, for the purpose of learning to program with the library.

This package includes modules on the following topics:

Bresenham Line Drawing (1)
Color Manipulation (LUTs) (3)
Color Perception (1)
Line & Polygon Clipping (5)
Polygon Scan Conversion (3)
Raster Filling (1)
Three-Dimensional Transformations (2)
Two-Dimensional Transformations (1)
Windows & Viewports (1)

For some topics, more than one group developed modules; the number of
modules available for each topic is indicated in the parentheses.

Please note that these modules were, for the most part, designed and
implemented by students satisfying course credit. Hence, the quality
of the modules provided varies substantially. I suggest that you
screen any modules you plan to use before making them available to
students, in order to determine their suitability for your teaching

If you are only interested in perusing or using the provided modules,
you can simply compile the package and ignore the library. If you are
interested in developing new modules -- or modifying/extending the ones
provided -- you should step through the demos developed for learning to
program the library (see below). I have found it useful to teach the
programming of the library in lab sessions and then assign course
projects to teams of 2-3 students to build new modules. The creativity
provided by the students in their projects can serve as the foundation
for developing redesigned, more-complete modules. And the necessity
for the students to attempt to *explain* the concepts covered in a
chosen topic allows for ready evaluation of the students' grasp of
those concepts, as well as the programming skills needed to implement
them using the library.


This package was developed using C and SGI's GL (Graphics Language) on
SGI Indigo XS24 and Indigo2 Extreme workstations running the IRIX 5.3
operating system with 1,280X1,024-pixel, 24-bit frame buffers and
20-inch monitors.

The following standard Unix utilities are needed to extract, compile
and install this package: ar, cc, cd, cp, csh, gcc (from the GNU
project), lex, make, mkdir, uncompress, rm, strip, tar & yacc. The
following system libraries are used during compilation: c_s, fm_s,
gl_s, m, and image. The SGI buttonfly utility can be used for
convenient access to running the demos and modules.

The compiled library expects certain Unix utilities to be available in
certain specific locations; namely: /bin/mail, /bin/rm, /usr/sbin/tops,
/bin/echo, /bin/sed, /bin/sh. These are specified (and can be changed)
in $CGMODS_DIR/src/library/environment.h. Note that not all of these
may be invoked. For example, the mail program is only invoked if a
special hidden file (.mailto) is created in a module's executable
directory, in which case email will be sent to all of the recipients
listed in the file, providing usage statistics of the module. Another
example is the tops command for converting from RGB files to
PostScript(TM) files; automated conversion using this feature is
currently disabled.

After all modules and demos are compiled and installed and the libraries
are cleaned up, this package takes up almost 30 Mb (~6 for the src, ~1
for documentation, and ~21 for the executables).


You should have two files: cgmodules.README (the one you are reading
now) and cgmodules.tar.Z, a compressed tar file containing the
package. Choose a directory location in which you would like to store
the package in a subdirectory called cgmodules; let's call the chosen
directory "parent_directory". To extract the package:

mv cgmodules.tar.Z parent_directory
cd parent_directory
uncompress cgmodules.tar.Z
tar xf cgmodules.tar
cd cgmodules

Now edit the file "setup", changing the entry "/project/cgmodules" on
the line:

setenv CGMODS_DIR /project/cgmodules

to "/.../parent_directory/cgmodules". For example, if you chose
/usr/local/packages as your parent_directory, you would change the
line to:

setenv CGMODS_DIR /usr/local/packages/cgmodules


To compile & install the package, run:

cd parent_directory/cgmodules
source setup
cd src

Some time later, two versions of the library, all the demos and all
the modules will have been compiled and installed, and the makefile
will have cleaned up after itself, removing the libraries, .o files,
etc. There are individual "compile", "install" and "cleanup" entries
in all of the makefiles, in case you want to carry out only some of
these steps (e.g., if you want to compile the libraries and leave them
around for development of new modules). The demos and modules are
installed under $CGMODS_DIR/bin; the libraries are installed under
$CGMODS_DIR/library and $CGMODS_DIR/library/old_version (but they are
removed in the cleanup phase if you just run "make").


To use the provided modules and examine the provided library demos,
users can run:

source parent_directory/cgmodules/setup
cd $CGMODS_DIR/demoButtonfly

Users can add the source command to their .cshrc startup files. Please
see the man page for SGI's buttonfly to learn how to use this utility
to access the package's demos and modules.

To achieve some degree of consistent user interaction across modules,
the bottom portion of the screen is reserved for three standard panels
of control buttons. On the left is the Section Panel, with buttons for
each of the major sections defined for the module. On the right is the
Control Panel with buttons for continuing with the next step of the
module, saving the current screen in RGB format, and quitting the
module. Between these two is the Animation Panel, which appears when
user control is needed to step through an animation or algorithm;
there are VCR-like buttons for rewinding to the beginning, playing one
step forward, playing continuously, fast-forwarding to the end, and


If you are interested in developing your own modules (or modifying the
ones provided), you might find it helpful to study the provided library
demos and accompanying exercises. The demos are compiled along with
the modules and are accessible through the buttonfly interface. The
source code for the library is in $CGMODS_DIR/src/library and the code
for the demos is in $CGMODS_DIR/src/demos. There are man pages for the
library routines in $CGMODS_DIR/doc/man/manl and documentation for the
demos in $CGMODS_DIR/doc/demos.

Please note that there is an 'old' version of the library (used by the
Two-Dimensional Transformations, Windows & Viewports, and Bresenham
Line Drawing modules) which is undocumented and should not be used for
further development.

The demos are organized into five groups:

Init initialization using the library
Object features of the various objects
Button interaction and button properties
Workspace primitives defined for workspaces
General toy applications

The suggested order in which the demos should be examined is listed
below; $CGMODS_DIR/src/demos/demoScript is a script to automatically
step through the demos in the suggested order. For each demo, there is
a corresponding documentation file which lists the concepts introduced
by the demo, notes on the routines, man pages to look at for related
information and a suggested exercise; these are available as PostScript(TM)
files in $CGMODS_DIR/doc/demos.

Demo Description
---- -----------

Init/OpenWindow Open a single window of maximum size
Init/MultiWindow Open multiple windows with predefined positions
Init/ColorAndFont Specify colors and define fonts

Object/Button Create an Exit button in the center of a window
Object/Bitmap Show different kinds of bitmaps
Object/InputBox Create integer and float inputboxes
Object/ScrollBar Create and link scrollbars with inputboxes
Object/WorkSpace Create workspace with text & geometric shapes
Object/TextBox Display various types of text

Button/CallBack Change callback function for a single button
Button/CheckButton Create `check' relationships within buttons

Workspace/AllPrim Show all available primitives
Workspace/BasicXform Show 4 transformations in separate workspaces
Workspace/PixelDraw Simulate zoom function in a painting program
Workspace/Draw Simple drawing program using five primitives
Workspace/Polylines Show usage of polygons and polylines
Workspace/Basic3DXform 3D viewing, model and light
Workspace/Basic3DCXform 3D composite transformations
Workspace/EdgeTableDS Show the edge table data structure graphically

General/Algorithm Insertion sort
General/ColorEditor Set colors in RGB mode using scrollbar
General/Menu Demo intro page, section & control panels


The provided modules are intended to be self-documenting. Man pages
for the library routines are located in $CGMODS_DIR/doc/man/manl and
documentation for the online demos is located in $CGMODS_DIR/doc/demos.


Much of the material in the provided modules follows the presentations
laid out in Computer Graphics by Francis S. Hill, Macmillan Publishing
Company, New York, 1990.

A short paper describing the project can be found in ``Interactive
Teaching Modules for Computer Graphics,'' Avi C. Naiman, Computer
Graphics, Volume 30, Number 3, August 1996, pp. 33-35. A longer
version is in preparation; send me email if you would like a copy
of the manuscript when it is available.


-- Almost all of the programs were written by undergraduate students
fulfilling academic requirements, mostly with little or no active
supervision; consequently, many bugs continue to infest the system.
All modules, demos and library routines are provided on an "as-is"
basis, with no warranty of usability expressed or implied. While I
hope that the modules are useful in your teaching and/or research, I
am aware that there are many bugs in the programs, as well as errors
in the concepts presented. Some amount of bug extermination was
carried out on the following modules: Two-Dimensional Transformations,
Windows & Viewports, and Bresenham Line Drawing; hence, their quality
is somewhat better.

-- As the 50+ programmers on this project were not native English
speakers, much of the on-screen text and accompanying documentation
contains typographical, syntactic and semantic errors, or is just plain
hard to understand.

-- The timing controls developed are based on the execution speeds of
the machines used during development (Indigo XS24's and Indigo2
Extreme's, some with the R4400 processor). On faster machines,
animations are likely to take place too quickly.

-- The font choices and text placement assume a 19- or 20-inch
monitor. On other monitors, text may overlap, appear in the wrong
place, or even disappear.

-- Many debugging statements are printed out on stdout and stderr.
They can, of course, be redirected to /dev/null.

-- The package depends on SGI's Graphics Library (GL). Porting to
OPENGL should be fairly straightforward. GL-dependent code appears in
the following files in $CGMODS_DIR/src/library: 2Dxform.c, bitmap.c,
defineobject.c, events.c, graphics.c, key.c, menu.c, primitive.c,
raster.c, screen1.c, screen2.c, template.c, test.c, test1.c, text.c,
viewport.c, winop.1.c, and winop.c. I would be very interested to
hear of any efforts to port to OPENGL (or other platforms).

-- While I welcome feedback and suggestions, this project is currently
in limbo, so there are no guarantees that bugs will be fixed any time


The work reported here was supported by a HKUST School of Engineering
Multimedia Teaching Initiative Grant. Nelson Mak served as a full-time
programmer on this project during the 1995-1996 academic year; Gibson
Lam, Kwok Ki Wan and Matthew Wong participated as research assistants
and to fulfill their final-year project requirements; 50+ students in
the Spring 1996 Computer Graphics courses made contributions as part of
their course projects. I thank the Media Research Laboratory at New
York University for providing me with access to their facilities in
order to prepare this package for distribution.

Avi C. Naiman
1 April 1997


Powered by Plone CMS, the Open Source Content Management System

This site conforms to the following standards: