CGR-Unit-1 Basics of Computer Graphics.pdf

rugvedcollection 332 views 24 slides Jul 08, 2024
Slide 1
Slide 1 of 24
Slide 1
1
Slide 2
2
Slide 3
3
Slide 4
4
Slide 5
5
Slide 6
6
Slide 7
7
Slide 8
8
Slide 9
9
Slide 10
10
Slide 11
11
Slide 12
12
Slide 13
13
Slide 14
14
Slide 15
15
Slide 16
16
Slide 17
17
Slide 18
18
Slide 19
19
Slide 20
20
Slide 21
21
Slide 22
22
Slide 23
23
Slide 24
24

About This Presentation

Computer Graphics (22318)
Basics of Computer Graphics Notes.


Slide Content

Second Year Diploma Courses in Computer Science & Engineering / Computer
Engineering / Computer Technology / Information Technology Branch.


Computer Graphics
As per MSBTE ‘I’ Scheme Syllabus
CGR-22318

Unit-I
Basics of Computer Graphics
Total Marks- 08

Contents:

1.1 Image and Objects, pixel and resolution, Text mode. Graphics mode. Basic Graphics
Pipeline, Bitmap and vector based Graphics, Application of Computer Graphics.
1.2 Display Devices: Raster scan Display, random scan display, Flat Panel Display, LED,
LCD Display, Plasma, Touch screen.
1.3 Output primitives: line, polygon, marker, text.
1.4 Graphics functions and standards
1.5 Latest trends in Computer Graphics: Virtual reality, Augmented reality.

Unit-I Basics of Computer Graphics
CGR-22318 www.studyroom.xyz Page 2


Unit-I Basics of Computer Graphics

1. Introduction to Computer Graphics

 Computer graphics displays information in the form of graphics objects as windows,
graphs, diagrams etc. Thus, computer graphics express data in pictorial form.
 In computer graphics objects are represented as collection of pixels, where pixel is
smallest addressable point which can be displayed on screen. Pixel can be displayed
on screen by setting its intensity and color.
 A broad classification of major subfields in computer graphics might be:
1. Geometry: Studies ways to represent and process surfaces.
2. Animation: Studies with ways to represent and manipulate motion.
3. Rendering: Studies algorithms to reproduce light transport.
4. Imaging: Studies image acquisition or image editing.


2. Image and Object
 An image is basically representation of a real world object on a computer. It can be
an actual picture display, a stored page in a video memory, or a source code
generated by a program.
 Mathematically, an image is a two dimensional array of data with intensity or a color
value at each element of the array. In simple term, an image is defined by pixels.
 Object are real world entities defined in three dimensional world co-ordinates.

3. Pixel and Resolution
3.1. Pixel
 Pixel stands for picture element. A pixel is the smallest piece of information in an
image.
 In computer graphics objects are represented as collection of pixels, where pixel is
smallest addressable point which can be displayed on screen.
 Pixel can be displayed on screen by setting its intensity and color.
3.2. Resolution
 It is expressed in terms of the number of pixels on the horizontal axis and the number
on the vertical axis.
 In pixel resolution, the term resolution refers to the total no. of count of pixels in an
digital image.

Unit-I Basics of Computer Graphics
CGR-22318 www.studyroom.xyz Page 3


 For example, if an has M rows and N columns, then its resolution can be defined as
M X N.

4. Text mode and Graphics Mode
 There are basically two types of graphics modes namely, Text mode, and Graphics
mode.
 There are different graphics functions available in these two modes useful for
drawing different effective texts and different types of geometric shapes.

4.1. Text Mode
 In text mode, a display screen is divided into rows and columns of boxes. Each can
contain one character. Text mode is also called character mode.
 All video standards support a text mode that divides the screen into 25 rows and 80
columns.
 Text mode is also known as Character mode or Alphanumeric mode.

4.1.1. Text mode graphics function
1) Window( ):- This function specifies a window on screen. The four integer co-
ordinates of the window are passed as parameters to this function.
Syntax- window(left, top, right, bottom);
2) putch( ): It displays a single character at cursor position.
Syntax – putch( char);
Example- putch(‘A’);
Displays character A at specified cursor position.
3) clrscr( ): It clears the entire screen and locates the cursor in top left corner of
screen i.e(1,1).
Syntax – clrscr( );
4) gotoxy( ): It positions the cursor to the specified location on screen, where location
is specified by x, y co-ordinates of the point.
Syntax – gotoxy(x, y);
Where x, y are co-ordinates of a point where cursor is to be positioned.
Example: gotoxy(3, 4);
It positions cursor to 3
rd
row, 4
th
column.

Unit-I Basics of Computer Graphics
CGR-22318 www.studyroom.xyz Page 4


5) puts( ): It display string at cursor position.
Syntax – puts(s1);
Where, s1 is string to be displayed at specified cursor position. For puts( ) and
putch( ) functions, gotoxy( ) can be used.
Example: gotoxy(3, 4);
puts(“Hello”);
gotoxy(10,10);
putch(‘A’)
Here, Hello is displayed starting from the position 3,4 and ‘A’ is displayed at
10,10.
6) textcolor( ): It sets the colour for the text. Any text displayed after this command
will be displayed in a colour specified by this command. The supported colours are
numbered from 0 to 15.
Colour constant Colour name
0 BLACK
1 BLUE
2 GREEN
3 CYAN
4 RED
5 MAGENTA
6 BROWN
7 LIGHT GRAY
8 DARK GRAY
9 LIGHT BLUE
10 LIGHT GREEN
11 LIGHT CYAN
12 LIGHT RED
13 LIGHT MAGNETA
14 YELLOW
15 WHITE
128 BLINK

Syntax: textcolor (color);
Example: textcolor(‘GREEN’);
Is equivalent to int col= 2;
textcolor(col);
Above both codes displays subsequent texts in green colour.
7) deline( ): It delets a line specified by cursor position. After deletion, all subsequent
lines will be pushed up by one line.
Syntax: deline( );

Unit-I Basics of Computer Graphics
CGR-22318 www.studyroom.xyz Page 5


Example: gotoxy(12, 4);
delline( );
Above statement delets 8
th
line.
8) inline( ): It inserts a blank line at current cursor position.
Syntax: inline( );
Example : gotoxy(8, 4);
inline( );
It inserts a line at 8
th
row.
9) textbackgroud( ): It changes background colour of text. The valid colour for
CGA(Color Graphics Adapter) are from 0 to 6. They are:
Constant Colour Name
0 BLACK
1 BLUE
2 GREEN
3 CYAN
4 RED
5 MAGENTA
6 BROWN

Syntax: textbackground(color);
Example : int col = 4
textbackground(col);
It sets text’s background colour to red
10) moveto( ): It moves cursor to the location specified by int(x, y) co- ordinates.
Syntax: moveto(x, y);
11) outtextxy( ): (“sentence”)
OR
Outtextxy(x, y, “sentence”)
Where, x, y gives co-ordinates of a point where from to display text.
It displays text within quotation mark at specified position and with latest setcolour
style.

5. Basic Graphics Pipeline.
Computer Graphics is a process of mapping 3D scenes on a 2D screen.
Graphics pipeline or rendering pipeline defines the primitive operations required for
this mapping. These operations depends on hardware and software.

Unit-I Basics of Computer Graphics
CGR-22318 www.studyroom.xyz Page 6



Graphics pipeline primarily works in three stages –
1. Application
2. Geometry
3. Rasterization





1. Application :
In this stage, the user interacts with the 3D scenes and changes it as per his
requirement. These changes must be reflected on the screen.
The new scene with its primitive shapes, like a point, line triangles are passed to the
next stage.
2. Geometry :
The geometry step, which is responsible for the majority of the operations with
polygons and their vertices can be divided into the following five task.






Objects are first created in word coordinate with their actual dimensions. Required
objects are placed in the world coordinate system. Camera position is determined in a
world coordinate system, which determines the view of placed objects. Approximate light
sources are consider to illuminate the scene, parallel or perspective projection transforms
the 3D scene from the real world to 2D representation as per the camera viewing direction.
The real world scene which is outside the clipping window will be rejected to reduced
the further computation.
The projected and the clipped scene is then mapped to the display device. Window to
viewport transformation does these mapping.
3. Rasterization :
In the rasterization, an image described in a vector graphics format(shapes) is
converted into a raster image (pixel or dot’s) for output on a video display or printer or
for storage in a bitmap file format.


Application Geometry Rasterization Screen

Model &
Camera
Transformation

Lighting

Projection

Clipping
Window
Viewport
Transformation
Object
Coordinates
Camera
Coordinates
Clipping
Coordinates
Device
Coordinates

Unit-I Basics of Computer Graphics
CGR-22318 www.studyroom.xyz Page 7






6. Bitmap and vector based Graphics
 Computer graphics can be classified into two categories namely, Raster or
Bitmap graphics and vector graphics.
6.1. Bitmap Graphics(Raster Graphics):
 It is pixel based graphics.
 Bitmap images (also known as raster images) are made up of pixels in a grid.
Pixels are picture elements (tiny squares of individual color that make up what
you see on your screen.). All these tiny square of color come together to form
the images you see.
 Bitmap images are resolution dependent.
6.2. Vector based Graphics(Vector Graphics):
 The images in vector Graphics are basically mathematically based images.
Unlike bitmaps, vector images are not based on pixel patterns, but instead use
mathematical formulas to draw lines and curves that can be combined to create
an image.
 Vector based images have smooth edges and therefore used to create curves
and shapes. Vector images are edited by manipulating the lines and curves that
make up the image using a program.

 Difference between Bitmap and Vector based graphics -

Sr. No. Bitmap Based Graphics Vector Based Graphics
1 It is pixel based graphics. It is mathematical based graphics.
2 Bitmap images are resolution
dependent.
Vector images are resolution
independent.
3 Suited for web application. Not suited for web application.
4 Modification is difficult. Modification is easier.
5 Conversion from bitmap to vector
graphics is difficult.
Conversion from vector to bitmap
graphics is easy.
6 Border start appearing Zigzag. Border start appearing smooth.
7 Ex. JPEG, GIF, BMP etc. Ex. True type fonts, logo, Symbols etc.

Unit-I Basics of Computer Graphics
CGR-22318 www.studyroom.xyz Page 8


7. Applications of computer graphics
 Now a days computer Graphics is used in variety of field ranging from daily
routing activities to very high end specialized areas.
 Some of major applications of computer graphics are listed below
1. Computer Aided Design/ Drafting(CAD/CADD)
2. Geographical information system(GIS).
3. Desktop publishing(DTP)
4. Graphical User Interface(GUI)
5. Digital Art.
6. Entertainment.
7. Image Processing
8. Education and training
9. Presentation Graphics, Scientific and Engineering Graphics
10. Medical applications.
11. Communication.
12. Simulation


8. Display devices:
 The Display devices are also known as output devices. Display device is a device used
for presentation of information such as image or text for visual purpose. i.e to display
information.
There are two techniques used for producing image on CRT screen : Raster Scan and
Vector scan / Random scan.
8.1. Raster Scan Display:

Architecture of a raster display

Unit-I Basics of Computer Graphics
CGR-22318 www.studyroom.xyz Page 9



The fig. shows the architecture of a raster display. It consists of display controller,
central processing unit (CPU), Video controller, refresh buffer, keyboard, mouse and the
CRT.
The display image is stored in the form of 0’s and 1’s in the refresh buffer. The video
controller reads this refresh buffer and produces the actual image on the screen. It does
this by scanning one scan line at a time, from top to bottom and then back to the top as
shown in the fig.


Raster Scan CRT
When the beam is moved from the left to the right, it is ON. The beam is OFF, when it
is moved from the right to the left as shown by dotted line. When the beam reaches the
bottom of the screen it is made OFF and rapidly retraced back to the top left to start
again. A display produced in this way is called raster scan display.


8.2. Random Scan (Vector Scan) Dipaly :


Architecture of a vector display
 Fig. shows the typical vector display architecture. It consist of display controller,
central processing unit (CPU), display buffer memory and a CRT. The display buffer
memory stores the computer produced display list or display program. The program

Unit-I Basics of Computer Graphics
CGR-22318 www.studyroom.xyz Page 10


contains point and line plotting commands with (x,y) or (x,y,z) end point
coordinates, as well as character plotting commands. The display controller interprets
commands for plotting points, lines and characters and sends digital and point
coordinates to vector generator. The vector generator converts the digital coordinates
values to analog voltages for beam deflection circuits that displace an electron beam
writing on the CRT’s phosphor coating.
In vector displays beam is reflected from end point to end point, hence this technique
is also called random scan. we know as beam, strikes phosphor it emits light. But
phosphor light decays after few milliseconds and therefore it is necessary to repeat
least 30 times per second to avoid flicker. As display buffer is used to store display
list and it is used for refreshing, the display buffer memory is also called refresh
buffer.

8.3. Flat panel display:
 The term flat panel display refers to a class of video device that have reduced volume,
weight and power requirement as compared to CRT.
 Flat panel display devices are very thinner than CRT. These display devices have low
volume, weight and power requirement as compared to CRT. The many variants of flat
panel displays determine the resolution and quality of picture.
 The main two types of flat panel display are Emissive display and Non- Emissive
Display.
1. Emissive Display: These devices convert electrical energy into light. For example,
Devices – PLASMA PANELS, LIGHT EMITTING DIODES (LED) etc.
2. Non- Emissive Display: They use optical effects to convert sunlight or light from some
other source into graphics patterns. For example, Liquid Crystal Device (LCD) and
Laser Scan Display.

Unit-I Basics of Computer Graphics
CGR-22318 www.studyroom.xyz Page 11


8.4. Plasma Panels

 Plasma panels also referred as gas-discharge display.
 It consist of two sheets of glass with thin and closed spaced gold electrodes attached to inner
faces and covered with dielectric material.
 These are attached as series of vertical conductors on other glass plate. The space between two
glass plate, is filled with neon based gas and is sealed.
 By applying voltage between electrodes the gas within panel is divided into tiny cells and each
cell is independent of its neighbours.

8.5. Light emitting diodes
 LED is a semiconductor that illuminates when an electrical charge passes through it.
 In this display a matrix of multi-color light emitting diode is arranged to form the pixel
position in the display. And the picture definition is stored in refresh buffer.
 Similar to scan line refreshing of CRT information is read from the refresh buffer and
converted to voltage levels that are applied to the diodes to produce the light pattern on
the display.
 A light emitting diode is made up of a semiconductor chip which is surrounded by a
transparent plastic case. The plastic case allows the light to pass though it.
 The emission of different colors including ultraviolet and infrared light depends on the
semiconductor material which is used in the diode.
8.5.1. Advantages of LED
1. Low power consumption.
2. Better and sharper screen resolution.
8.5.2. Disadvantages of LED
1. High price.

Unit-I Basics of Computer Graphics
CGR-22318 www.studyroom.xyz Page 12


8.6. LCD Display


 LCD is a flat panel display, electronic visual display, or video display that uses
the light modulating properties of liquid crystals.
 This display use nematic (thread like) liquid crystal compounds that tend to keep
the long axes of rod shaped molecules aligned. These nematic compounds have
crystalline arrangement of molecules, yet they flow like a liquid and hence
termed as Liquid Crystal Display.
 The LCD shows three types of mesophase i.e, Smectic , Nematic (thread like) and
Cholestric. In Mematic phase, the long axis of liquid crystal molecules align parallel to
each other. The alignment direction is sensitive to temperature, surface tension, pressure
and electric and magnetic fields. The optical characteristics of Liquid crystal are also
sensitive to these effects.
 There are two types of LCD displays namely Active Matrix LCD and Passive Marix LCD.
8.6.1. Advantages of LCD
1. Light weight
2. Small size
3. The consumption of power is low
4. Low cost.
8.6.2. Disadvantages of LCD
1. Low reliability
2. Speed is slow

Unit-I Basics of Computer Graphics
CGR-22318 www.studyroom.xyz Page 13




8.7. Touch Screen
 It is an input technology. A touch screen is a computer display screen that is
sensitive to human touch. A touch screen is a display device that allows the user
to interact with a computer by using their finger.
 Touch screens are used on a variety of devices such as computer and laptop
monitors, smartphones, tablets etc.
 A touch screen may contain pictures or words that the user can touch to interact
with the device.
 A touch has two main advantages
1. It allows users to interact directly with what is displayed.
2. It does not require the use of an intermediate device.
The three main technologies are explained below:
8.7.1. Resistive:
 This screen has a thin metallic layer that is conductive and resistive, so that
touching results in a change in the electrical current sent to the controller.
8.7.2. Surface Acoustic Wave(SAW)
 Ultrasonic waves pass over this screen. Touching it results in absorption of part of the
wave, registering the position of the touch, which is sent to the controller.
8.7.3. Capacitive
 This screen is coated with an electrically charged material. Touching it causes a
change in capacitance, which allows the location to be determined and sent to the
controller.’

9. Output Primitives
Graphics primitives are the functions that we use to draw actual lines and the characters
that make up the picture. These functions provide convenient method to application
programmer for describing pictures.
9.1. Point: Plots a single pixel on screen.
Attributes: x, y, co-ordinate position, color.
For example, consider following
command
Putpixel(x, y, color); It displays pixel at x,y, co-ordinate position in given color.
9.2. Line: It draws a straight line.
Attributes: Line type, width, color, cap etc.

Unit-I Basics of Computer Graphics
CGR-22318 www.studyroom.xyz Page 14


For example, consider following command.
lineto(x, y): It draws a straight line from current beam position to the point(x, y).
Line( x1,y1, x2,y2): It draws a straight line form (x1, y1) co –ordinate position to (x2, y2)
position.
setlineType(parameter);
setLineWidth(parameter);
setLineColor(parameter);
9.3. Text: Draws a string of characters.
Attributes: font, color, siz, spacing, orientation, height, width.
Font example,
 Type (Helvetica, times, courier etc.)
 Size (10pt, 14 pt, etc)
 Style (bold, italic, underlined)
For example, consider following command:
TEXT(X, Y, STRING)
Where (X, Y) is the text position and STRING is a string of characters.
setTextFont(parameter);
setTextColor(parameter);
9.4. Polygons:
 A set of line segments joined end to end. Some graphics device supports polygon
drawing approach, where directly basic polygon shapes are drawn. So here one
polygon is saved as one unit.
 Standards command for drawing triangle (polygon) could be,
Triangle (x1, y1, x2, y2, x3, y3 )
Where,
(x1,y1), (x2,y2) and (x3, y3) are co ordinates of three vertices of triangle and
thus supports, direct polygon drawing commands.
Consider the following command:
drawpoly(x[ ], y[ ], n);
where, x[ ] is array of x co-ordinate of all line segment end points, y[ ] is array
of y co-ordinates of all line segment end points. N is number of corners of
polygon +1.
9.5. Marker:
 It draws a specified symbol at given co-ordinated position in different color and
different sizes. We can select a particular character to be a marker symbol.

Unit-I Basics of Computer Graphics
CGR-22318 www.studyroom.xyz Page 15


Attributes: marker type, size color etc.
For example, consider following command:
drawmarker(x[ ], y[ ], n); which is as drawpoly. Instead of drawing a polygon it
will draw symbols on polygon edges.
setPolymarkerSize( );
setPolymarkerType( );
for example,
setPolymarkerType(‘*’); It will draw * symbol all round polygon edges.

Unit-I Basics of Computer Graphics
CGR-22318 www.studyroom.xyz Page 16


10. Graphics Functions and Standards.
10.1. Graphics mode and Graphics mode function
 Graphics mode is a computer display mode that displays image using pixels.
 In graphics mode, the display screen is treated as an array of pixels. Programs
that run in graphics mode can display an unlimited variety of shapes and fonts.
10.1.1. Basic Graphics Mode functions:
1. initgraph( ): It is used to initialise graphics mode.
Syntax: initgraph( int driver, int mode, char path);
Where,
 driver: This argument specifies the graphics driver to be used and it interfaces
with display adapter, some of available drivers are CGA, EGA, VGA etc.
 mode: Each graphic adapter can use several different possible graphics
modes. The mode argument is used to select particular mode. Following table
shows different possible modes for CGA, VGA, EGA etc.




 path: It specifies path to graphics driver. Graphics drivers are files with
BGI(Borland Graphics Adapter) file extension supplies as part of Turbo C++.
The path name is string therefore it must be surrounded by quotes.
Example: initgraph(&gd, &gm, “c:\\tc\\bgi”);
int gm, gd= DETECT

Where, gd- specifies graphics driver
gm- specifies graphics driver
“c:\\tc\\bgi”- specifies paths of BGI files.
DETECT- is micro which automatically selects the driver.
2. closegraph( ):
It is used to close graphics mode.
Syntax: closegraph( );
Note:- CGA- Computer Graphics Adapter
VGA- Video Graphics Adapter
EGA- Enhanced Graphics Adapter

Unit-I Basics of Computer Graphics
CGR-22318 www.studyroom.xyz Page 17




10.1.2. Graphics Mode functions for Shape
 Computer graphics has many inbuilt commands, which can be used either to
draw a shape and /or for filling a colour in any bounded shape.
1. lineto( ): This command draws a line on screen from current cursor positions to
the(x, y) positions mentioned in command.
Syntax- lineto(x, y);
Where, (x, y) are co-ordinates of end of line.
2. line( ): This command draws a line on screen.
Syntax: line(x1, y1, x2, y2);
Where, (x1, y1) are co-ordinates of starting point of line and (x2, y2) are co-
ordinates of end point of line.
Example :- line(10, 10, 100, 100);
It will draw a line from point (10, 10) to point (100, 100).
3. circle( ): This command draws a circle on screen.
Syntax: circle(x, y, r);
Where, (x, y) are co- ordinates of centre of circle and r is radius of circle.
Example :- circle (50, 50, 10);
It draws a circle with centre 50, 50 and radius 10.
4. rectangle( ): This command draws a line on screen.
Syntax: rectangle(x1, y1, x2, y2);
Where, (x1, y1) are co-ordinates of top left corner point of rectangle and (x2, y2)
are co-ordinates of bottom right corner point of rectangle.
Example :- rectangle(10, 10, 100, 100);
It will draw a rectangle as a top left corner is(10,10) & bottom right corner
is(100,100).
5. ellipse( ): It draws an ellipse on screen.
Syntax: ellipse(x, y, start, end , xrad, yrad);
Where,
x, y are co ordinates of centre point.
start, end- starting and ending angle of ellipse.
xrad, yrad: x- axis and y-axis radius respectively.
For full ellipse, the start and end should be 0 to 360 else it will draw an arc on
screen.
Example :- ellipse(100, 100, 0, 360, 20, 10);

Unit-I Basics of Computer Graphics
CGR-22318 www.studyroom.xyz Page 18




6. drawpoly( ): It draws outline of polygon having specified number of sides.
Syntax: drawpoly(n, array);
Where,
n is number of vertices of a polygon +1.
Array is integer array name which stores co- ordinates of vertices of a polygon.
Example: To draw a triangle with drawpoly.
drawpoly(4, m);
where,
m is array which stores co –ordinates of vertices of a triangle.


10.2. Need for Standards
 A good computer graphics system includes good software, as well as, a
compatible hardware.
 Both computer graphics vendors as well as users indentified some needs to
have some graphics standards.
The needs are as follows
1. Software portability.
2. Image data portability.
3. Text data portability.
4. Model database portability.
10.3. Standards for Computer Graphics
1. CORE (Core of a Graphics System)
2. GKS (Graphics kernel system)
3. IGES(Initial Graphics Exchange Specifications)
4. PHIGS(Programmer’s Hierarchical Interactive Graphics System)
5. CGM(Computer Graphics Metafile)
6. CGI(Computer Graphics Interface)


11. Latest trends in Computer Graphics:
11.1. Virtual Reality
 Virtual reality means experience things though our computers that don’t really
exist. Virtual Reality (VR) literally makes it possible to experience anything,
anywhere , anytime. It is the most immersive type of reality

Unit-I Basics of Computer Graphics
CGR-22318 www.studyroom.xyz Page 19


technology and can convince the human brain that it is somewhere it is really
not.
 VR is able to immerse you in a computer generated world of your own making:
a room , a city the interior of human body.
11.1.1. Components of Virtual Reality System
1. Virtual world:- A virtual world is a three-dimensional environment that is
often, but not necessarily, realized through a medium where on can interact
with others. Two common types of immersion include.
a. Mental immersion- A deep mental state of engagement, with suspension of
disbelief that one is in a virtual environment.
b. Physical immersion: Exhibited physical engagement in a virtual
environment, with suspension of disbelief that one is in a virtual
environment.
2. Virtual Reality Engine:- It is the main component of any VR system and it
consists of simulation engine and graphics engine.
a. Scene Database-
b. Graphic Engine-
c. Simulation Engine
d. User Interface(UI)
3. Interactive
4. Sensory feedback


11.1.2. Types of Virtual Reality
 There are more than one approach to building virtual worlds and thus more
than one flavour of virtual reality.
1. Non- immersive- These simulations are the least immersion
implementation of virtual reality technology.
For example, an architect might build a detailed 3D model of a new
building to show to clients that can be explored on a desktop computer by
moving a mouse.
2. Fully –immersive simulations – provides the most immersive
implementation of virtual reality technology.
3. Semi immersive- These simulations provide a more immersive experience,
in which the user is partly but not fully immersed ina virtual envoirnment.

Unit-I Basics of Computer Graphics
CGR-22318 www.studyroom.xyz Page 20


11.1.3. Devices used in virtual Reality System.
1. Console / Smartphone/Computer.
2. Head mounted display
3. Input devices
o Joysticks.
o Force balls/ tracking balls.
o Controller wands
o Data gloves
o Trackpads
o On- device control buttons
o Motion trackers/ bodysuits
o Treadmills
o Motion platforms
11.1.4. Applications
o Education
o Entertainment
o Industrial design and architecture
o Scientific visualization
o Medical field

11.2. Augmented Reality
 Mixed Reality(Augmented Reality):
o The seamless merging of real space and virtual space.
o Integrate the computer generated virtual objects into the physical world
which become in a sense an equal part of our natural environment.
 An AR system combined the real and the virtual in order to assist the user in
perform his task. So we can say that, an augmented(mixed) reality is a halfway
point between a non-immersive and fully immersive CR system.
 Mobile devices like smartphones and tablets have put supercomputer power in
our hands and pockets. If we are wondering round the world, maybe visiting a
heritage site like the pyramids or a fascinating foreign city we have never been
to before, what we want is typically not virtual reality but an enhanced
experience of the exciting reality we can see in front of us. That’s the idea of
Augmented Reality(AR).

Unit-I Basics of Computer Graphics
CGR-22318 www.studyroom.xyz Page 21


11.2.1. Types of Augmented Reality (Category)
1. Marker based.
2. Markerless
3. Projection based
4. Superimposition based


12. Graphics Basic Programs
12.1. C program to draw circle built-in graphics commands.
#include<stdio.h>
#include<graphics.h>
#include<conio.h>
int main( )
{
int gd= DETECT, gm;
int x, y, radius=80;
initgraph(&gd, &gm, “C:\\Turboc3\BGI”);
/* Initialize center of circle with center of screen */
x = getmaxx( ) / 2;
y= getmaxy( ) / 2;
outtextxy(x-100, 50, “Circle using Graphics in C”);
/*Draw circle on screen*/
circle(x, y, radius);
getch( );
closegraph( );
return 0;
};
Output:-
Circle Using Graphics in C

Unit-I Basics of Computer Graphics
CGR-22318 www.studyroom.xyz Page 22




12.2. Simple program to draw circle.
#include<stdio.h>
#include<graphics.h>
#include<conio.h>
int main( )
{
int gd= DETECT, gm;
initgraph(&gd, &gm, “C:\\Turboc3\BGI”);
circle(25, 25, 100);
getch( );
closegraph( );
return 0;
}


12.3. C program to draw rectangle and a line.
#include<stdio.h>
#include<graphics.h>
#include<conio.h>
int main( )
{
int gd= DETECT, gm;
initgraph(&gd, &gm, “C:\\Turboc3\BGI”);
/* Draw rectangle on screen */
rectangle(150, 50, 400, 150);
/* Draw line on screen */
Line(500, 150, 600, 250);
getch( );
closegraph( );
return 0;
}

Unit-I Basics of Computer Graphics
CGR-22318 www.studyroom.xyz Page 23


Output-



12.4. Program to draw polygon.

#include<stdio.h>
#include<graphics.h>
#include<conio.h>
int main( )
{










}
Output -
int gd= DETECT, gm;
int points[ ]= {320, 150, 420, 300, 250, 300, 320, 150 };
initgraph(&gd, &gm, “C:\\Turboc3\BGI”);
drawpoly(4, points);
getch( );
closegraph( );
return 0;

Unit-I Basics of Computer Graphics
CGR-22318 www.studyroom.xyz Page 24


12.5. C program to draw a circle and fill it by color and pattern.

#include<stdio.h>
#include<graphics.h>
#include<conio.h>
int main( )
{
int gd= DETECT, gm;
initgraph(&gd, &gm, “C:\\Turboc3\BGI”);
circle(100, 100, 50);
setfillstyle(HATCH_FILL, RED); // set fill pattern and color
floodfill(100, 100, RED); // 100, 100 is just a point inside circle
getch( );
closegraph( );
}


Output-













End of Chapter No.1....