Module 1

Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 119

A Survey of

COMPUTER GRAPHICS

TEXT BOOK :
 DONALD HEARN & M.PAULINE BAKER
Contents
Definition of CG
Computer – Aided Design
Presentation Graphics
Computer Art
Entertainment
Education and Training
Visualization
Image Processing
Graphical User Interfaces
What is Computer Graphics?
 Creation, Manipulation and Storage of
geometric objects (modelling) & their images
(rendering).
 Display those images on screens or hardcopy
devices.
Applications of Computer
Graphics
Computer Aided Design (CAD)
Presentation Graphics
Computer Art
Entertainment (animation, games, …)
Education & Training
Visualization (scientific & business)
Image Processing
Graphical User Interfaces
1.Computer Aided Design (CAD)
Used in design of buildings, automobiles,
aircraft, watercraft, spacecraft, computers,
textiles & many other products
Objects are displayed in wire frame outline
form
Software packages provide multi-window
environment
Graphics design package provides
standard shapes (useful for repeated
placements)
Animations are also used in CAD
applications
Realistic displays of architectural design
permits simulated “walk” through the
rooms (virtual -reality systems)
2.Presentation Graphics
Used to produce illustrations for reports
or generate slides for use with projectors
Commonly used to summarize financial,
statistical, mathematical, scientific,
economic data for research reports,
managerial reports & customer
information bulletins
Examples : Bar charts, line graphs, pie
charts, surface graphs, time chart
Examples of presentation
graphics
Examples of presentation
graphics
3.Computer Art
Used in fine art & commercial art
Includes artist’s paintbrush programs, paint
packages, CAD packages and animation
packages
These packages provides facilities for designing
object shapes & specifying object motions.
Examples : Cartoon drawing, paintings, product
advertisements, logo design
Computer Art
Electronic painting
Picture painted electronically on
a graphics tablet (digitizer) using a stylus
Cordless, pressure sensitive stylus
Morphing
A graphics method in which one object is
transformed into another
4.Entertainment
 Movie Industry
Used in motion pictures, music
videos, and television shows.
Used in making of cartoon
animation films
Computer Graphics is about
animation (films)
 Game Industry
Focus on interactivity
Cost effective solutions
Avoiding computations and
other tricks
5.Education & Training
Computer generated models of physical,
financial and economic systems are used
as educational aids.
Models of physical systems, physiological
systems, population trends, or equipment
such as color-coded diagram help trainees
understand the operation of the system
 Specialized systems
used for training
applications
 simulators for practice
sessions or training of
ship captains
 aircraft pilots
 heavy equipment
operators
 air traffic-control
personnel
Training
6.Visualization
 Scientific Visualization
Producing graphical representations
for scientific, engineering, and
medical data sets.
To check the behaviour of certain
process different fields like
engineering, scientists business
analysts etc need appropriate
visualization.
Scientific Visualisation
To view below and
above our visual range
Business Visualization is used in connection
with data sets related to commerce, industry
and other non-scientific areas
Techniques used- color coding, contour plots,
graphs, charts, surface renderings &
visualizations of volume interiors.
Image processing techniques are combined
with computer graphics to produce many of
the data visualizations
7. Image Processing
CG- Computer is used to create a picture
Image Processing – applies techniques to
modify or interpret existing pictures such
as photographs and TV scans
Medical applications
Picture enhancements
Tomography
Simulations of operations
Ultrasonics & nuclear medicine scanners
2 applications of image processing
Improving picture quality
Machine perception of visual information
(Robotics)
To apply image processing methods
Digitize a photograph (or picture) into an image
file
Apply digital methods to rearrange picture parts
to
 enhance color separations
 Improve quality of shading
Tomography – technique of X-ray photography
that allows cross-sectional views of physiological
systems to be displayed
Computed X-ray tomography (CT) and position
emission tomography ( PET) use projection
methods to reconstruct cross sections from
digital data
Computer-Aided Surgery is a medical application
technique to model and study physical functions
to design artificial limbs and to plan & practice
8.Graphical User Interfaces
 Major component – Window manager (multiple-
window areas)
 To make a particular window active, click in
that window (using an interactive pointing
device)
 Interfaces display – menus & icons
 Icons – graphical symbol designed to look like
the processing option it represents
 Advantages of icons – less screen space, easily
understood
 Menus contain lists of textual descriptions &
icons
VIDEO DISPLAY DEVICES
• Primary output device in a graphics system
• Cathode-Ray Tube (CRT)
– Operation of most video monitors used to
be based
on CRTs
• Other technologies now dominating
– LCDs
– Plasma-panel displays etc.
Refresh Cathode-Ray Tubes
A beam of electrons (cathode rays),
emitted by an electron gun, passes through
focusing and deflection systems that direct
the beam toward specified positions on the
phosphor-coated screen.
The phosphor then emits a small spot of
light at each position contacted by the
electron beam. Because the light emitted
by the phosphor fades very rapidly, some
method is needed for maintaining the
screen picture
Operation of an Electron Gun
Raster-Scan Displays
Raster-Scan Displays
In a raster-scansystem,the
electron beam is swept across
the screen, one row at a time,
from top to bottom. Each row is
referred to as a scan line
Picture definition is stored in a
memory area called the
refreshbuffer or frame
buffer,where the term frame
Raster scan system
Interactive raster-graphics
systems typically employ
several processing units.
In addition to the central
processing unit (CPU), a
special-purpose processor,
called the video controller or
display controller, is used to
control the operation of the
Raster scan system
Raster scan system
A fixed area of the
system memory is
reserved for the frame
buffer, and the video
controller is given
direct access to the
frame-buffer memory.
OpenGL Point-Attribute
Functions
We set the size for an OpenGL point with

glPointSize (size);
OpenGL Point-Attribute
Functions
Line Attributes
Line width is set in OpenGL with the
function

glLineWidth
(width);
INPUT DEVICES
• Keyboards
• Mouse
• Joysticks
• Image scanners
• Touch panels
• Light pens
• Etc…
Graphics Workstations and Viewing
Systems
 Graphics workstations range from small general-purpose
computer systems to multi-monitor facilities, often with
ultra-large viewing screens.
 For a personal computer, screen resolutions vary from
about 640 by 480 to 1280 by 1024, and diagonal screen
lengths measure from 12 inches to over 21 inches.
 For a desktop workstation specifically designed for
graphics applications, the screen resolution can vary from
1280 by 1024 to about 1600 by 1200, with a typical screen
diagonal of 18 inches or more.
 High-definition graphics systems, with resolutions up to
2560 by 2048, are commonly used in medical imaging, air-
traffic control, simulation, and CAD.
Contd…
Color Plate 7 shows a 360 paneled viewing system in
the NASA control-tower simulator, which is used for
training and for testing ways to solve air-traffic and
runway problems at airports.
A large, curved-screen system can be useful for
viewing by a group of people studying a particular
graphics application, such as the example in Color
Plate 8.
Graphics Networks
 Various resources, such as processors, printers,
plotters, and data files, can be distributed on a
network and shared by multiple users.
 A graphics monitor on a network is generally
referred to as a graphics server, or simply a
server. Often, the monitor includes
standard input devices such as a keyboard
and a mouse or trackball. In that case, the
system can provide input, as well as being an
output server.
 The computer on the network that is executing
a graphics application program is called the
client, and the output of the program is
displayed on a server.
INTRODUCTION TO
OpenGL
Contd…
Contd…
first step is to initialize GLUT

glutInit (&argc, argv);


Next, we can state that a display window is
to be created on the screen with a given
caption for the title bar.

glutCreateWindow ("An Example OpenGL


Program");
glutInitWindowPosition
(50, 100);

GlutInitWindowSize (400,
300);

 glutInitDisplayMode (GLUT_SINGLE |
GLUT_RGB);
glutDisplayFunc
(lineSegment);
glutMainLoop ( );

It displays the initial


graphics and puts the
programming to an
infinite loop that
checks for input from
devices such as a
mouse or keyboard.
Contd…
OpenGL Point Functions
We use the following OpenGL function to
state the coordinate values for a single
position:

glVertex* ( );

where the asterisk (*) indicates that


suffix codes are required for this
function
OpenGL Point Functions
We use the following OpenGL function to
state the coordinate values for a single
position:

glVertex* ( );
Coordinate positions in OpenGL can
be given in two, three, or four
dimensions. We use a suffix value of
2, 3, or 4 on the glVertex function to
indi cate the dimensionality of a
coordinate position.
OpenGL Point Functions
We use the following OpenGL function to
state the coordinate values for a single
position:

glVertex* ( );
Suffix codes for specifying a
numerical data type are i (integer), s
(short), f (float), and d (double).
OpenGL Point Functions
We use the following OpenGL function to
state the coordinate values for a single
position:

glVertex* ( );
Ex:
glVertex2i
OpenGL Point Functions
Calls to glVertex functions must be
placed between glBegin function
and a glEndfunction.

 The argument of the glBegin


function is used to identify the kind
of output primitive that is to be
displayed, and glEnd takes no
arguments.
OpenGL Point Functions
Calls to glVertex functions must be
placed between glBegin function
and a glEndfunction.

 The argument of the glBegin


function is used to identify the kind
of output primitive that is to be
displayed, and glEnd takes no
arguments.
glBegin (GL_POINTS);
glVertex* ( );
glEnd ( );
Cont…
Alternatively, we could specify the
coordinate values for the preceding
points in arrays such as

int point1 [ ] = {50, 100};


int point2 [ ] = {75, 150};
int point3 [ ] = {100, 200};
and call the OpenGL functions for plotting
the three points as
glBegin (GL_POINTS);
glVertex2iv (point1);
glVertex2iv (point2);
glVertex2iv (point3);
glEnd ( )
A set of straight-line segments
between each successive pair of
endpoints in a list is generated using
the primitive line constant GL_LINES.
Contd…
Contd…
Line Drawing algorithms
DDA (Digital Differential
Analyzer)
DDA (Digital Differential
Analyzer) is a line drawing
algorithm used in computer
graphics to generate a line
segment between two specified
endpoints.
EXAMPLES

 (5,4) and (12,7)

 (5,7) and (10,15)


EXAMPLES

 (2,2) and (9,2)


 (2,5) and (2,12)
Bresenham’s Line Algorithm
Bresenham’s Line Algorithm

(10,11)
Bresenham’s Line Algorithm

(11,12) ?
(11,12)
(10,11) (11,11)
OR

(11,12)
Bresenham’s Line Algorithm
Bresenham’s Line Algorithm

• Assuming that we have determined that the


pixel at (xk, yk) is to be displayed, we next need
to decide which pixel to plot in column

• Our choices are the pixels at positions

(x k +1 , yk) and (xk +1, yk +1).


Bresenham’s Line Algorithm
Bresenham’s Line Algorithm
Bresenham’s Line Algorithm
Contd…
(35,40) & (43,45)
DDA Algorithm
Contd…
Contd…
Problems
Contd…
Contd…
Contd…

You might also like