Department of Computer Engineering
Academic Year : 2022-25 (Semester |)
Model Answer InSem
Q-1 (a) Define the term: Color Depth, Scan Conversion, Refresh Rate, Pixel 4 Marks
Color Depth: tis determined by the number of bits assigned to hold values,
Lbit= 2 colors,
Abit 16 colors
8 bite 256 colors
416 bit« 30 approx.( 32768)
24 bit « 16 million color
32 bit latest true color
The display adapter stores value in a memory for every point on the screen,
Scan Conversion : The process of represerting a continuous graphical objects as a
collection of discrete pixels by identifying their locations end setting them On is called
sean conversion . The process of determining which pixels will provide the best
apptoximation to the desired tine is properly known as rasterization, Combined with the
process of rendering the picture in scan line oider it is known as scan conversion,
Refresh rate: Speed by which a particular point on the screen getting printed. Initially VGA
> 60 Hz., due to flickring effect, it uses 70 Hz. Frequency. User can set the refresh rate by
making use of driver of a particular display adapter,
‘Scan Conversion:
Pixel: in computer graphics, pictures or graphics objects or each screen point
represented a5 a collection of discrete picture elements which are called a5 pixels. It is
also referred to as a pel, as it is a smallest addressable screen element. It is the smallest
piece of screen, which we can control by setting the intensity and color. Each pixel on the
graphics display does not represent the mathematical point but the region which
theoretically can contain an infinite number of points.Q-4 (b) Differentiate between Random Scan and Raster Scan.
6 Marks
‘Base of Difference | Raster Scan System Random Scan System
Hlectron Beam | The electron beam is swept across the | The electron beam is directed only to the
screen, one row at a time, from top to | parts of screen where a picture is to be
bottom. drawn,
Resolution Tes resolition Te poor because faster | is resolution Ts good because this system
system in contrast. produces zigzag | produces smooth lines drawings because
lines that are plotted as discrete point | CRT beam directly follows the line path.
sets,
Picture Definition | Picture definition is Hored as set of | Picture definition le stored as a set of ine
intensity values for all screen points, | drawing instructions in a display file
called pixels ina refresh buffer area
Realistic Display | The capability of this stom to store | These systems are designed for Tine
intensity values for pixel makes it well | drawing and can't display realistic shaded
suited for the realistic display of scenes | scenes.
contain shadow and color pattern,
Draw an image | Screen polntalphels are used to draw | Mathematical functions are used to draw
‘an image. animage.
Q-2 (a) Define the term: Resolution, Aspect Ratio, Frame Buffer, Refresh Rate 4 Marks
Resolution: It refers to the maximum number of dots or points that can be displayed on the
screen without overlap on the Cathode Ray Tube (CRT). It is expressed as the number of
points per centimeter that can be plotted horizontally and vertically. Resolution depends
‘on the type of phosphor, the intensity to be displayed and the focusing and deflection
systems used in the CRT. The most commonly used four resolutions today are: 640 480,
1024 = 768, 800 = 600, 1280 = 1024.
Aspect Ratio: This number gives the ratio of vertical points to horizontal points necessary
to produce equal-length line in both directions on the screen, Sometimes itis also referred.
to as the ratio of horizontal to vertical points. An aspect ratio of 5/6 means that a vertical
line plotted with 5 points has the same length as a horizontal line plotted with 6 points.
eg, aspect ratio of 12° « 16" display is 12/16 = 3/4.
Frame Buffer: special area of memory is dedicated to graphics only, and picture definition
is stored in this memory area which is called frame buffer or refresh buffer. This memory
area holds the set of intensity values for all the screen points and the stored intensity
value are then retrieved from this frame buffer and painted on the screen one row at a
time to display pictureQ-2 (b)Compare DDA Line Drawing Algorithm with DA Line Drawing Algorithm . 6 Marks
Vector Generation Algorithm/ Bresenhamé Line Algorithm
DDALine Algorithm
© it uses Floating point © it uses only integer addition,
arithmetic subtraction and multiplication by 2
© Due to ‘floating point | © is quicker than
arithmetic and wunding vector generation algorithm
function ittakes more time.
Less efficient More efficient
© Where speed is important this | © Hardware Implementation is
algorithm need «tothe not required.
implemented in hardware
Q-3 (a) Write a short note on “Handling Keyboard inputs with GLUT. 6 Marks
glutKeyboardFunc sets the keyboard callback for the cusrent window.
Function : void glutKeyboardFunc(void (‘func)(unsigned char key, int x, int y));
Description
'* glutkeyboardFunc sets the keyboard callback for the current window. When a user types
into the window, each key press generating an ASCII character will generate a keyboard
callback.
* The key callback parameter is the generated ASCII character. The state of modifier keys
such as Shift cannot be determined directly; their only effect will be on the returned
ASCII data,
* The x and y callback parameters indicate the mouse location in window relative
coordinates when the key was pressed.
* During @ keyboard callback, glutGetModifiers may be called to determine the state of
modifier keys when the keystroke generating the callback occurred.
KeyDownEvent : A KeyDownEvent is sent each time you press a key on the keyboard, The
key pressed contains the keyCode property for thet event. If that key press has text input
associated with it, additional events are sent for each character of text input. The character
property contains the character for those events.
KeyUpEvent: 4 KeyUpEvent is sent when you release a key on the keyboard, The keyCode
property for that event contains the key being released. KeyDownEvent has additional
events sent when a keystroke has an associated text input.Q-3 (b) Explain the Significance of error term in Bresenham’s circle Drawing Algorithm.
Explain its mathematical derivation . 6 Marks
+ It considers the eight-way symmetry of the circle to generate it
+ Itplots 4/8th part of circle, i. from 90"to 45° as shown in figure.
+ As circle is drawn from 90'to 45° the x moves in positive direction and y moves in
negative direction.
+ Toachieve best approximation to the true circle select those pixels in the raster that
fall the least distance from the true circle
+ can be found by applying either of the two options:
‘+ Increment in positive x direction by one unit or remain y as itis,
+ Increment in positive x direction and negative y direction by one unit.
+ Consider P (xy) as a last scan converted pixel.
+The next to choose pixel A or pixel B
+ The closer pixel amongst these two can be determined as follows:
fcircle(xy)=e
+ This function determines a circle with radius r around the origin in the following
way
For point A the equation of crele will be
8) =Aety)
= Gerth?
For point B the equation of circle will be
FB) -FoeyrLy,-1)
= (xr Pry, tye
We are going to choose the point A or point B which is nearer to the expected circle.
So the decision variable dis calculated by making the sum of function.
s=fA)1),
£(A) is always positive and f(B) is negative
+ If variable will cantain either -ve value or 0 then A pointis closer to circle
Point A when d
=0
d =f(A)+f(B)
4 (6) (yt) AY) -F
* Put initial value (xO,yO) is (O,r)
+ FA)=FO% +L. n)
= (#1)? (Yo)*-?
+ 1)24(r) 21?
#8) = (x, #4, y, 2)
= (xot1)?4(yo-1)?-17
+ 1)2+(r-1)2-re
2r
d= 14+2-2r
d=3-2r
Casel: d=0
Previous point is B Next point will be either D or E.
F(D)=f04,42, Yoo)
= (x2) Hy)?
FE) 42,y-2)
= (AP Hy 2
d=f(C)+(0)
= (6gt2P Hyp DP Hey Py 2?
d=d+4(x,-y,) 410
Q-4 (a) Describe OpenGL architecture with block diagram in detail. 6 Marks
linet Mode _ Geometric
Pipeline
The fist stage provides an efficient means for approximating curve and surface
geometry by evaluating polynomial functions of input values.
The next stage operates on geometric primitives described by vertices: points, tine
segments, and polygons. In this stage vertices are transformed and lit, and
primitives are clipped to a viewing volume in preparation for the next stage,
rasterization.
The rasterizer produces a series of framebuffer addresses and values using a
‘two-dimensional description of a point, line segment, or polygon.
Each fragment produced is fed ta the next stage that performs operations on
dividual fragments before they finally alter the framebuffer.© These operations include conditional updates into the framebuffer based on
incoming and previously stored depth values (to effect depth buffering), blending of
incoming fragment colors with stored colors, a5 well as mast
operations on fragment values
© Finally, pixel rectangles and bitmaps bypass the vertex processing portion of the
pipeline to send a block of fragments directly through rasterization to the individual
fragment operations, eventually causing a block of pixels to be written to the
framebutfer.
‘© Values may also be read back from the framebuffer or copied from one portion of
the framebuffer to another. These transfers may include some type of decoding or
encoding,
1g and other logical
(Q-4 (b) Explain Bresenham Circle drawing algorithm in detall. 6 Marks
+ Itconsiders the eight-way symmetry of the clrcle to generate It.
+ It plots 1/8th part of circle, Le. from 90°to 45° as shown in figure.
As circle is drawn from 90°to 45° the x moves in positive direction and y moves in
negative direction.
plot.)
plot (y,-3)
plot(s,-1}
pltea-y)
phtey-9)
plot ya) and
potex)
Step 1. Accept radius & centre coordinatorsfrom user & plot first point on
circumference of circle (y)=(0.)
Step 2. Calculate initial value of decision parameter s-3-2r
Step 3. By octant symmetric property plot pixels until x