You are on page 1of 36

COMPUTER GRAPHICS &

MULTIMEDIA
BTCS-503

NIKHIL CHATURVEDI
WHAT IS COMPUTER GRAPHICS ?
 Creation, Manipulation and Storage of
geometric objects (modeling ) & their
images (rendering )

 Display
those images on screens or
hardcopy devices
WHY COMPUTER GRAPHICS?
 Fun! Visible!
 Everywhere

 Visual system offers:

Parallel input
Parallel processing
 Computer graphics: ideal for human-computer
communication
APPLICATIONS
 Graphs and charts
 Computer-Aided Design

 Virtual Reality

 Data Visualization

 Education and training

 Computer Art

 Movies

 Games

 Graphical User Interfaces


COMPUTER-AIDED DESIGN

AutoDesk

IAME 2-stroke race kart engine


DATA VISUALIZATION

Bruckner and Groeller, Bruckner and Groeller,


TU Vienna, 2007 TU Vienna, 2007
GAMING
GENERATING GRAPHICS
 Special-purpose
programs
Photoshop, Powerpoint, AutoCAD,
StudioMax, Maya, Blender, PovRay, …

 General
graphics libraries and standards
Windows API, OpenGL, Direct3D,…
CG STANDARDS
 Setof graphics functions, to be called from
programming language
 Access to and abstract from hardware

 Standardization
DISPLAY DEVICES

The most commonly used display device is a video


monitor.
The operation of most video monitors based on CRT
(Cathode Ray Tube). The following display devices
are used:
 Refresh Cathode Ray Tube

 Random Scan and Raster Scan

 Color CRT Monitors

 Direct View Storage Tubes

 Flat Panel Display

 Lookup Table
CATHODE RAY TUBE (CRT):
COMPONENTS OF CRT:

Main Components of CRT are:


1. Electron Gun: Electron gun consisting of a series of elements, primarily a
heating filament (heater) and a cathode. The electron gun creates a source of
electrons which are focused into a narrow beam directed at the face of the CRT.
2. Control Electrode: It is used to turn the electron beam on and off.
3. Focusing system: It is used to create a clear picture by focusing the electrons
into a narrow beam.
4. Deflection Yoke: It is used to control the direction of the electron beam. It
creates an electric or magnetic field which will bend the electron beam as it
passes through the area. In a conventional CRT, the yoke is linked to a sweep or
scan generator. The deflection yoke which is connected to the sweep generator
creates a fluctuating electric or magnetic potential.
5. Phosphorus-coated screen: The inside front surface of every CRT is coated
with phosphors. Phosphors glow when a high-energy electron beam hits them.
Phosphorescence is the term used to characterize the light given off by a
phosphor after it has been exposed to an electron beam.
RANDOM SCAN DISPLAY:

Random Scan System uses an electron beam which


operates like a pencil to create a line image on the CRT
screen. The picture is constructed out of a sequence of
straight-line segments. Each line segment is drawn on
the screen by directing the beam to move from one point
on the screen to the next, where its x & y coordinates
define each point. After drawing the picture. The system
cycles back to the first line and design all the lines of the
image 30 to 60 time each second.
Random-scan monitors are also known as vector displays
or stroke-writing displays or calligraphic displays.
ADVANTAGES AND DISADVANTAGES
Advantages:
 A CRT has the electron beam directed only to the parts
of the screen where an image is to be drawn.
 Produce smooth line drawings.

 High Resolution

Disadvantages:
 Random-Scan monitors cannot display realistic shades
scenes.
RASTER SCAN DISPLAY

 A Raster Scan Display is based on intensity control of


pixels in the form of a rectangular box called Raster on
the screen. Information of on and off pixels is stored in
refresh buffer or Frame buffer. Televisions in our house
are based on Raster Scan Method. The raster scan system
can store information of each pixel position, so it is
suitable for realistic display of objects. Raster Scan
provides a refresh rate of 60 to 80 frames per second.
 Frame Buffer is also known as Raster or bit map. In
Frame Buffer the positions are called picture elements or
pixels. Beam refreshing is of two types. First is
horizontal retracing and second is vertical retracing.
ADVANTAGES AND DISADVANTAGES
Advantages:
 Realistic image

 Million Different colors to be generated

 Shadow Scenes are possible.

Disadvantages:
 Low Resolution

 Expensive
DIFFERENTIATE BETWEEN RANDOM AND RASTER
SCAN DISPLAY
FUNCTIONS
 Graphics Output Primitives
Line, polygon, sphere, …
 Attributes
Color, line width, texture, …
 Geometric transformations
Modeling, Viewing
 Shading and illumination
 Input functions
SOFTWARE STANDARDS
 GKS, PHIGS, PHIGS+ (1980-)
 GL (Graphics Library, SGI)

 OpenGL (early 1990s)

 Direct3D (MS), Java3D, VRML,…


OPENGL
 3D (and 2D)
 Fast

 Hardware, language, OS, company independent

 OpenGL architecture review board

 Broad support

 Low-level (right level!)

 Standard graphics terminology


INTRO OPENGL
 Few basic principles
 Needed for assignments

 Here: OpenGL 1.1

 Modern versions (incl. WebGL): closer to


hardware, older versions easier to understand
MORE INFO ON OPENGL
 http://www.opengl.org,

http://www.opengl.org/sdk/docs/man2/
 The Red Book:

http://www.glprogramming.com/red/
 Many other web-sites

 No need to learn by head, aim at

being able to read manual pages


OPENGL, GLU AND GLUT
 OpenGL: basic functions
 GLU: OpenGL Utility library:

 GLUT: OpenGL Utility Toolkit library

 GLUand GLUT:
Handy functions for viewing and geometry
OPENGL AND JAVA
 C: glFunction(); gluFunction();
glutFunction();

 Java: JOGL
gl.glFunction();
glu.gluFunction();
glut.glutFunction();

 No windowing functions offered by JOGL


 Assignment: skeleton offered
OPENGL SYNTAX
 Functions:

glFunction: glBegin, glClear, glVertex, …


 Constants:

GL_CONSTANT: GL_2D, GL_LINE


 Datatypes:

GLtype: GLbyte, GLint, GLfloat


EXAMPLE
glClearColor(1.0,1.0,1.0,0.0);// Background color
glMatrixMode(GL_PROJECTION); // Set
transformation
glLoadIdentity;
gluOrtho2D(0, 200, 0, 150);

glClear(GL_COLOR_BUFFER_BIT); // Clear background

glColor3f(1.0, 0.0, 0.0); // Set color to red


glBegin(GL_LINES); // Draw line
glVertex2i(180, 15); // - first point
glVertex2i(10, 145); // - second point
glEnd; // Ready with line
glFlush; // Send
EXAMPLE
END OF UNIT I

Any questions till now ?


Thank You
PRACTICAL
FUNCTIONS OF GRAPHICS.H HEADER
FILE
 Arc
 #include <graphics.h>
#include <conio.h>
 int main()
{
   int gd = DETECT, gm;
    initgraph(&gd, &gm, "C:\\TC\\BGI");

    arc(100, 100, 0, 135, 50);
  
   getch();
   closegraph();
   return 0;
}
 Line
 C programming code for line

 #include <graphics.h>
#include <conio.h>
 main()
{
   int gd = DETECT, gm;
    initgraph(&gd, &gm, "C:\\TC\\BGI");

    line(100, 100, 200, 200);

    getch();
   closegraph();
   return 0;
}
 Putpixel
 C programming code for putpixel

 #include<graphics.h>
#include<conio.h>
 main()
{
   int gd = DETECT, gm;
    initgraph(&gd, &gm, "C:\\TC\\BGI");

    putpixel(25, 25, RED);

    getch();
   closegraph();
   return 0;
}
ASSIGNMENT FOR TODAY

You might also like