You are on page 1of 15

# COURSE OUTLINE

## The following is the course outline for Introduction to Computer Graphics.

1. INTRODUCTION
What is Computer Graphics?
Why study Computer Graphics?
Applications of Computer Graphics
Graphics Hardware
- Display Devices (Raster and Vector)
- Processors
- Input processor
Graphics Software (Application Programmers Interface for Computer Graphics)
GKS, PHIGS, OpenGL, Direct3D, Java3D, VRML and others
Review of Linear Algebra for Computer Graphics
- Vector Theory and Matrix Algebra
2D and 3D Concepts
2.

## GRAPHICS PRIMITIVE OBJECTS

2D Primitives
3D Primitives

3.

TRANSFORMATIONS
2D Transformations
3D Transformations

4.

VIEWING
2D Viewing
3D Viewing
Projection
- Orthogonal
- Perspective

5.

## SCAN CONVERSION / RASTERISATION

Line Drawing Algorithms
Circle Drawing Algorithms
Polygon Drawing Algorithms

6.

CLIPPING
Line Clipping Algorithms
Polygon Clipping Algorithms

TEXT BOOKS
-

## Foley, J., A. van Dam, S. K. Feiner and J. F. Hughes 1996.

Computer Graphics: Principles and Practice (Second Edition in C ed.).

## Foley, J., A. van Dam, S. K. Feiner, J. F. Hughes and R. L. Phillips 1993.

Introduction to Computer Graphics.

## Hearn, D. and P. M. Baker 1994.

Computer Graphics (Second Edition ed.).
London: Prentice Hall.

Angel, E. 2002.
OpenGL: A primer.

Hill, F. S. 2000.
Computer Graphics using OpenGL (Second Edition ed.).
London: Prentice Hall.

## - Woo, M., J. Neider, T. Davis and D. Shreiner 1999.

OpenGL Programming Guide (Third Edition ed.).

INTRODUCTION
WHAT IS COMPUTER GRAPHICS?
Computer Graphics is not about the study of the following packages:

## Components of Computer Graphics

Modeling: Defining objects in terms of primitives, coordinates and characteristics

## Rendering: Applying physically based procedures to generate (photorealistic)

images from scenes (using lighting and shading)
Viewing: Displaying images from various viewpoints on various devices

Computer Graphics are graphics created by computers and, more generally, the
representation and manipulation of pictorial data by a computer.
The study of Computer Graphics is a sub-field of Computer Science which studies
methods for digitally synthesizing and manipulating visual content. Although the term
often refers to 3D computer graphics, it also covers 2D graphics and image processing.
Graphics is a flourishing field within computer science. Driven by the tremendous
increase in speed and quality of hardware and software, it has rapidly gained popularity
among a wide variety of users. With applications as far-reaching as special effects,
synthetic content, interactive TV, graphical user interfaces, information visualization,
interactive art, industrial design, education, computer games ranging from Doom 3 to
The Sims, virtual reality, and the Internet, computer graphics plays an increasingly
important role in our lives, both practically and culturally. This course is aimed to be a
comprehensive introduction to basic concepts and algorithms in this field, and topics
covered will include the fundamentals of scan conversion of geometric primitives, 2D
and 3D transformations, 3D viewing and projection, color, hidden surface removal,
simple illumination models, modeling, animation, and user interfaces.

OUTPUT
INPUT
IMAGE
DESCRIPTION

IMAGE

DESCRIPTION

Image
Processing
Computer
Graphics

Pattern
Recognition
Data
Processing

## Fig. What is Computer Graphics?

The Fig. above gives the simplest explanation of Computer Graphics, that is, it is
the complete processes of taking the Description of an object or scene (as input),
and producing (as output) an Image of that object or scene using a computer
system. Image Processing, on the other hand takes in an Image and alters it in some
way (by applying special procedures) to produce another Image.
4

## WHY STUDY COMPUTER GRAPHICS?

Computer Graphics is an essential part of the Computer Science curriculum. It is the primary
method of presentation of information from computer to human. As such it is a core component
of any computer system, with computer graphics playing a major role in:
Entertainment - computer animation;

User interfaces;

Cartography;

Medicine;

## Computer aided design;

Multimedia systems;

Computer games;

Image processing.

## Uses of Computer Graphics:

General Areas of Use:

## Display of Information (Babylonion tablets 2000 A.D. orthographic projections).

Design (lack of unique solution, iterative process).
Simulation (scientific visualisation, entertainment, education/training).
User Interface (Windows95, Mac, X, Next etc.).

## Specific Areas of Use:

o Desktop publishing.
o E-mail.
o Hypermedia.
Graphs :
o Maths.
o Modeling.

Image Processing:
o Satellite.
o Medical.
o Weather.
o Police.
o Industry.
o Landscape.
o Buildings.
o Materials.
Art and Design :
o Graphic Design.
o Presentation.
o Television.
CAI :
o Laserdisk.
o "The Aussie BBQ".
o Flying.
o Driving.
o Shipping.
Animation :
o Games.
o Virtual Reality.
o Cartoons.
o Nuclear/Chemical Reactions.
o Physiology "VoxelMan".
Process Control :
o Real-time systems.
o Air Traffic Control.
o Refineries.
o Powerplants.
o Computer Networks.
Cartography :
o Geology.
o Oceanography
o GIS etc.

Hardware History:

## 1963 - GM truck/car computer design system.

1965 - IBM refresh screen (with memory), \$100,000 to 250,000, plus software!
1966 - Lockheed aircraft/missile design.
1968 - DVST (Direct View Storage Tube), Tektronix, \$15,000, popular until the
mid 1970s.
1969 - SIGGraph formed (Special Interest Group on Graphics).
1970s to 1980s - Raster screens, CAD, microcomputers.
1990s on... Hardware assisted virtual reality (desktop/games), photorealistic rendering of
scenes, fully computer animated movies (Toy Story), etc.

## Display (Output) Devices:

DVST:

Used until mid 80s, picture stored behind phosphor as a charge distribution on a grid.
No image in memory.
No flicker.
Long persistence.
Hi res., no staircasing.
Can only add to image, or erase it!

Refresh:

## Image held in RAM (card or motherboard, rapidly fading phosphor (varies)).

Picture redrawn many times.
Resolution - no. of addressable points.
Hi res. - more memory + no colours.

Random Vector:

## Electron beam "steered" to needed places.

One line per time; similar to pen plotter.
Requires file of display commands cycled through during each refresh of screen.
Image altered by changing commands in display file.

Raster Scan:

## Pixel based (picture elements).

Lower resolution but getting much better (eg. 1280 x 1024 16 million colours).
Far more common than random vector.
Beam traverses screen as a series of horizontal lines called scan lines (remember that!!!).
Needs memory map of pixel attributes.
Memory usually on separate card.

## Other types of Display:

LCD (Liquid Crystal Display):

## Two glass plates separated by organic conductive liquid crystal.

Electrical charge makes crystal opaque.
Mono - poor shades of grey.
Colour - lacks brightness of CRT.
Reflection problems - backlit screen.
Low power requirements.
Animation persistence problems.

Plasma Panel:

## Two glass plates separated by neon gas.

Very rugged.
No refreshing.
Screens can be transparent and overlay documents.
Generally only available in monochrome (Orange).

## Dot matrix printers.

Ink jet printers/plotters.
Laser printers.
Electrostatic printers/plotters.
Pen plotters :
o Drum.
o Flat bed.
o Round bed.
o Sprocket/friction feed.

Input Devices:

Keyboard.
Joystick.
Light pen (position located during refresh).
Mouse (mid 60s Doug Engelbart) :
o Originally ball driven.
o Infrared, cordless.
Graphics tablet/digitizer.
Trackball.
Glove.

Graphics Software:
Software is needed to utilise the above hardware. This takes the form of a software library which
application programmers use to render their graphics. A number of graphics software standards
have been developed to facilitate portability

Standards:

Core :
o
o
o
o

## 1974 U.S. Graphics Standards Planning Committee.

3D.
Over 200,000 current users.
Reasonable compatibility.

GKS:
1974 W. German standard (Graphics Kernel System).
Excellent, but no 3D until 1988.
Allows groups of primitives arranged as segments, but no nested segments.
PHIGS :
o 1988, (Programmers Hierarchical Interactive Graphics System).
o Complex and sophisticated.
o Supports nested structures.
o Supports structure databases.
o PHIGS Plus includes shading, lighting features.
o Very large package.
PEX :
o Phigs Extension to X.
Hoops :
o C++ library produced by Autodesk
OpenGL :
o Open Graphics Library.
o Is a software interface to graphics hardware.
o Is hardware, window and operating system independent. That's why it's Open!
o Created by SGI.
o Overseen by the ARB (Architecture Review Board), comprised of seven major
hardware/software manufacturers.
architecture of the system.
o No inherent structure, simply takes a 3D point and renders it to the screen.
OpenInventor :
o (Object - Oriented version of OpenGL)
Java-3D :
o Object-Oriented graphics library, still under development. Available RSN ;).
o
o
o

10

Conceptual Framework:

Graphics System:

## Performs transformations between application model and I/O devices.

eg. scaling, rotating, clipping, hidden line/surface removal, rendering, viewing
transforms, colour mapping, camera position, etc.

Application Model:

## Independent of display device

A 'database' of objects with attributes
Collections of primitives
Two or three dimensional
Relationships between objects
May include non-graphical data

11

2D and 3D CONCEPTS
2D Concepts:
For 2D viewing we employ the use of two axes, viz. x and y. This means that any point in 2D
space is specified by a two value system; (x, y).

3D Concepts:
Two dimensional viewing is limited in what it can represent. Reality is inherently three
dimensional. Therefore a method of rendering 3D objects must be used.
For 3D viewing we employ an additional axis, viz. z. This means that any point in 3D space is
specified by a three value system: (x, y, z).
There are two coordinate systems in use, right-hand and left-hand.
We can establish these by curling our fingers from +ve x direction to +ve y direction. The thumb
on the respective hand then points in the direction of the z-axis.

12

## The left-handed coordinate system is convenient in many graphics systems.

The right-handed coordinate system is popular with mathematicians.
SGL (Simple open Graphics Library (openGL)) uses a right-handed system (although it swaps
around a fair bit in the graphics pipeline, as we shall find out).

SGL Background:
SGL (Simple open Graphics Library (openGL)).
In previous years we have used the SPHIGS library, detailed in the text book, for implementing
3D graphics theory. Unfortunately the subject syllabus goes beyond what the package can offer.
So a new package was written to incorporate the capabilities needed by the course.
It is a simplification of the OpenGL 1.0 standard used in Industry.
Open GL is an industry specification for a software/hardware API to allow the rendering of 3D
objects. It does not cover such areas as Windowing and Input/Output. This makes it portable
across different operating systems and windowing systems (more later)
It is an "Immediate Mode" graphics library as distinct from a "Retained Mode" graphics library.
It comes on Linux and Irix 5.3 platforms. We will be using the X11 system. (In the future I might
write a windows/mac version of the software...maybe :-) )

13

It can do:

## 3Dimensional transformations of objects.

Full view camera model.
Hidden line/hidden surface removal.
Full multiple light model.
Double buffering.

It's free!!!!!!
It's as slow as a wet week!!!!! This is deliberate. The system is not intended for industry, just
education. Therefore the source-code has been written with clarity (?!!) in mind, not speed. This
facilitates the use of hyper-links from lecture pages to the source-code, as an aid in
understanding the theory.
It's probably bug-ridden!!!!!!!! Bear with me this semester as this is only the second time the
library has been used. We can expect some amount of trouble in using this system. If there is a
problem then email me, using the pro-forma I have provided at this web page.

Starting SGL:
In order to use the library the following must be carried out :

## Include the header file sgl.h

Include the windowing system header file sglx.h (This changes to suit the platform being
used).
Use the CCsgl command to compile the program (works the same as CCsrgp).
NB: You will have to include the path /usr/local/pub/sgl in your .login file (like with
srgp).
the system on Linux at home.

SGL types :
typedef
typedef
typedef
typedef
typedef
typedef
typedef
typedef

signed char
short
long
float
double
unsigned char
unsigned short
unsigned long

SGLbyte ;
SGLshort;
SGLint, SGLsizei;
SGLfloat, SGLclampf;
SGLfloat, SGLclampd;
SGLubyte, SGLboolean;
SGLushort;
SGLuint, SGLbitfield;

14

## Issue the following command to start SGL:

void sglxInit( char* name,*
SGLuint width,*
SGLuint height,*
int& argc,*
char* argv[],*
Widget widget,
BufferType buffer,*
void* initFunc,
void* exposeFunc,*
void* inputFunc,
void* resizeFunc );

## name appears as the title on top of the window.

width and height are pixel dimensions of the window.
argc and argv are the values passed from the main function.
widget is useful to those with knowledge of XWindows. You can mount the OpenGL
window onto an XWidget and use ViewKit or Motif etc. to do your interface.
buffer specifies three buffering situations Single, Double, File.
initFunc is the function called when the system first creates a window.
inputFunc is the function called when a key/mouse event has occurred.
resizeFunc is called when the window is resized.

## The use of some of these parameters will be explained in future lectures.

Make sure you end the program with:
void sglxFinish(void) ;

Otherwise it may cause problems with the SGI X Server on the Indy's.

15