Download as ppt, pdf, or txt
Download as ppt, pdf, or txt
You are on page 1of 32

Computer Graphics

(COMP462)
1

BULE HORA UNIVERSITY


BULE HORA INFORMATICS COLLEGE
DEPARTMENT OF COMPUTER SCIENCE

CHAPTER ONE
INTRODUCTION TO COMPUTER GRAPHICS
Topics we will cover
2

Introduction to computer Graphics


Graphics Primitives
Attributes of Graphics primitive
Transformations
The viewing pipeline
3D graphics
Animation

Dev C++ and OpenGL


Computer Graphics- Comp 462
Computer Graphics Definition
3

Computer graphics create pictures and images based


on some description, or model, in a computer.
Pictures generated by a computer.
 Example: A Ray-Traced picture with shadows.

We can define computer graphics as the algorithms


and hardware required to produce realistic and/or
useful images on a computer.
Computer Graphics- Comp 462
Computer Graphics Definition
4

Algorithms and Hardware required to produce realistic


and useful images on the computer.

Computer Graphics- Comp 462


Computer Graphics Definition
5

Algorithms and Hardware required to produce realistic


and useful images on the computer.

Computer Graphics- Comp 462


Rendering Definition
6

 Taking a picture of object model using a virtual camera.


 The rendering process can include many stages, such as
hidden surface elimination, surface rendering and clipping.

Figure - Rendering a 2-D Image from a 3-D Model


Computer Graphics- Comp 462
Applications of Computer Graphics
7

Computer Graphics- Comp 462


1. Graphs and Charts
8

 Graphs and charts have long been used for visualising data.
 They are particularly widely used for visualising relationships and
trends in scientific, mathematical, financial and economic data.

Figure - Computer Graphics used for Graphs and Charts


Computer Graphics- Comp 462
2. Computer Aided Design(CAD)
9

Used for design of buildings, automobiles, aircraft,


watercraft, spacecraft, computers, textiles, …

Multiple window, color coded CAD Color coded wireframe display of


workstation displays body designs for an aircraft
Computer Graphics- Comp 462
2. Computer Aided Design(CAD)…
10

Animations and wireframe displays used in CAD


allow the designer to see in to the interior of the
object and to watch the behavior of inner
components during motion.

Simulation of
vehicle performance
during path changes

Computer Graphics- Comp 462


2. Computer Aided Design(CAD)…
11

Architects also use it to lay out floor plan and design


different building features.
With virtual reality systems designers can even go
for a simulation walk through the rooms.

Realistic, 3D rendering of
building designs

Computer Graphics- Comp 462


2. Computer Aided Design(CAD)…
12

 Computer-Aided Manufacturing (CAM) is a similar concept to CAD, except that


the design application is linked to the manufacturing process, i.e. the application
will directly control, via a hardware communication link.

Figure - Computer Graphics used for Computer-Aided Design (CAD)

Computer Graphics- Comp 462


3. Data Visualization
13

 More complex, often multidimensional, datasets can also be visualised using


graphics techniques.
 For example, Shows a three-dimensional medical dataset of a patient.

Here we use computer graphics to Shows the use of colour to visualise


visualise the paths of blood vessels altitude in a map of the United
inside the patient’s head. States.
Figure - Computer Graphics used for Visualisation of Complex Datasets
Computer Graphics- Comp 462
4. Presentation Graphics
14

Used to produce illustrations for reports,


 Summarizing
 Financial
 Statistical
 Mathematical and scientific data
To generate slides.
Typical examples
 Bar charts
 Line graphs
2D bar and pie chart linked to
 Pie charts geographical chart
 …

Computer Graphics- Comp 462


5. Entertainment
15

For making motion pictures, music videos, and


television shows.
Graphical objects can be displayed by themselves or
can be combined with the actors and live scenes.

Avatar Toy Story


 The applications of computer graphics in entertainment fall into three categories:
computer art, special effects and animations, and games.

Figure - Computer Graphics used in the Entertainment Industry


Computer Graphics- Comp 462
6. Computer Art
16

Both fine arts and commercial art applications


For designing object’s shape and specifying object’s
motion Artists use:-
 Paint brush programs:
 Used to paint pictures on the screen of a video monitor using
graphics tablet and stylus.
 Paint packages
 Desktop publishing software
 Animation packages …

Cartoon drawing produced with a


paintbrush program
Computer Graphics- Comp 462
6. Computer Art…
17

For mathematical art there are software like


Mathematica with different mathematical functions.

Visualization of Fermat’s
Last Theorem.

For creating logos, TV advertising spots, page


layouts with text and graphics

Computer Graphics- Comp 462 TV Ads and 3D logo


7.Education and Training
18

 Computer graphics can be very beneficial in education and training.


 For some training applications using simulator,
 Visualizing physical, financial and economical system models.

Automobile simulator used to Shows a screenshot from some shows a screenshot


test drivers reaction educational software that from a simulator for
teaches students about human
laser eye surgery.
anatomy.
Figure - Computer Graphics used for Education and Training

Computer Graphics- Comp 462


8. Volume Visualization
19

 To visualize and analyse large amount of information for scientists,


engineers, medical personels, business analysts, ...
 Techniques: color coding, contour plots, graphs and charts, surface
rendering, visualizations of volume interiors, ...

Volume visualization of the color


Gamut of the image (ICC3D)
Computer Graphics- Comp 462
9. Image Processing
20

 Computer Graphics: creating a


picture using computers.
 Image Processing: modifying or
interpreting existing pictires
like photographs and TV scans.
 Application
 Image inhansment (improving image
quality)
 Machion perception of visual
information (Robotix) Blurred photograph of a
 Servilance license plate and the inhanced
 Together: they applied in version of it.
different applications.
 Example: In Medicine for
computer-aided surgery

Computer Graphics- Comp 462


10. Graphical User Interface
21

Interactive pointing devices


Displayed menues
Icons which represent some processing options

Graphical user interface (GUI) from paint application with menus, icons, and color plates
Computer Graphics- Comp 462
11. Vertual Rality and Augmented Reality
22

 Virtual Reality (VR) allows users to be immersed in a computer generated world, and to interact
with it as if they were interacting with the real world.
 Augmented Reality (AR) combines a computer-generated virtual world with the real world.

Figure - Computer Graphics used for Virtual Reality and Augmented Reality

Computer Graphics- Comp 462


Introduction to OpenGL
23

What is OpenGL?
OpenGL is a low-level software interface to
graphics hardware.
No commands for performing windowing tasks or

obtaining user input are included.
 No high-level commands for describing models of 3D
objects are provided.
Why low level?
You can access graphics hardware directly.

 Independent to window system, cross platform.

 High level enough, so it’s independent to graphics hardware.


 Industry standard.

Computer Graphics- Comp 462


API Hierarchy
24

Computer Graphics- Comp 462


What OpenGL provides?
25

Draw with points, lines, and polygons.


Matrix Operations (Transformations)
Hidden Surface Removal (Z-Buffer)
Lighting (Phong model)
Gouraud Shading
Texture mapping
Pixels operations

Computer Graphics- Comp 462


The Buffers
26

A buffer is a memory area in the graphics hardware


for some special purposes.
An OpenGL system can manipulate the four
buffers:
 Color buffers
 Depth buffer (Z-Buffer)
 Stencil buffer
 Accumulation buffer

Computer Graphics- Comp 462


Graphics Libraries
27

The most important of the OpenGL family of


graphics libraries:
 OpenGL :
 The core library, it is platform (i.e. hardware system) independent, but not
windows-system independent.
 glut:
 The GL Utilities Toolkit, it contains some extra routines for drawing 3-D
objects and other primitives.
 Using glut with OpenGL enables us to write windows-system independent
code.
 glu:
 The OpenGL Utilities, it contains some extra routines for projections and
rendering complex 3-D objects.
 glui:
 Contains some extra routines for creating user-interfaces.

Computer Graphics- Comp 462


Getting Started with OpenGL
28

The first thing we need to know to be able to start


writing OpenGL programs is which header files to
include.
 #include <GL/gl.h>
If we are only using the core OpenGL library, then this line must be added
near the beginning of your source code.
 #include <GL/glu.h>
 If we also want to use the GL Utilities library, we must add this line.
 #include <GL/glui.h>
 For the glui user-interface library we must add the above line.

 #include <GL/glut.h>
 If we want to use the glut library (and this makes using OpenGL a lot easier)
we do not need to include the OpenGL or glu header files. All we need to do
is include a single header file for glut.
 This will automatically include the OpenGL and glu header files too.

Computer Graphics- Comp 462


OpenGL Utility Toolkit (GLUT)
29

A window system-independent toolkit to hide the


complexity of differing window system APIs.
Providing following operations:
 Initializing and creating window.
 Handling window and input events.
 Drawing basic 3D objects.
 Running the program.

Computer Graphics- Comp 462


OpenGL Utility Toolkit (GLUT)…
30

The following lines initialise the glut library, define


a frame buffer and create a window for display.
 glutInit(&argc, argv);
 glutInitWindowSize(640,480);
 glutInitWindowPosition(10,10);
 glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB);
 glutCreateWindow(“GLUT Points Demo”);

Computer Graphics- Comp 462


OpenGL Utility Toolkit (GLUT)…
31

Let us examine each of these routines in turn:


 glutInit(&argc, argv);
 This line initialises the glut library. We must call this function before any
others in our glut/OpenGL programs.
 glutInitWindowSize(640,480);
 This function call sets the size of the display window in pixels.

 glutInitWindowPosition(10,10);
 This line sets the position of the top-left corner of the display window,
measured in pixels from the top-left corner of the monitor screen.
 glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB);
 This line defines the type of frame buffer we want to have. In this case, we are
asking for a single RGB (i.e. colour) frame buffer.
 glutCreateWindow(“GLUT Points Demo”);
 Finally, this function call creates the display window with the attributes
defined by the previous calls.
Computer Graphics- Comp 462
A Simple OpenGL Program

32

Computer Graphics- Comp 462

You might also like