0% found this document useful (0 votes)
109 views

Name: Waguma Leticia: Jomo Kenyatta University of Agriculture and Technology Nakuru Campus

The document discusses computer graphics concepts and OpenGL functions. It provides: 1) Explanations of scaling, shearing, translation, reflection, and rotation as used in computer graphics. It also outlines the general structure of an OpenGL program and the use of OpenGL libraries. 2) Details on how the Cohen-Sutherland line clipping algorithm clips lines to portions within a rectangular area. 3) Descriptions of window to viewport mapping in OpenGL and the functions for performing these transformations.

Uploaded by

Waguma Leticia
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
109 views

Name: Waguma Leticia: Jomo Kenyatta University of Agriculture and Technology Nakuru Campus

The document discusses computer graphics concepts and OpenGL functions. It provides: 1) Explanations of scaling, shearing, translation, reflection, and rotation as used in computer graphics. It also outlines the general structure of an OpenGL program and the use of OpenGL libraries. 2) Details on how the Cohen-Sutherland line clipping algorithm clips lines to portions within a rectangular area. 3) Descriptions of window to viewport mapping in OpenGL and the functions for performing these transformations.

Uploaded by

Waguma Leticia
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 9

JOMO KENYATTA UNIVERSITY OF AGRICULTURE AND TECHNOLOGY

NAKURU CAMPUS.

NAME: WAGUMA LETICIA

REGNO: SCT221-COO7-0609-2016

UNIT NAME: COMPUTER GRAPHICS

UNIT CODE: ICS 2311

LECTURER NAME: JAIRUS OUNZA

CAT 1
QUESTION ONE
a) Outline the basic functions of computer graphics Hardware and Software systems.
The hard drive is a kind of a hardware which is used to store graphical files because
it is fast. Also graphics card helps to display the graphics on screen to the user.
Random access memory can be used to process a rendering of animation.
Graphics software are used for editing and sharing digital photos, creating logos,
drawing and modifying clip art, creating digital fine art, creating web graphics,
designing advertisements and product packaging, touching up scanned photos, and
drawing maps or other diagrams.

b) Explain the following terms as used in computer graphics


i. Scaling
It is used to alter or change the size of objects. The change is done using scaling factors.
ii. Shearing
It is change in the shape of the object. It is also called as deformation. Change can be in the x
-direction or y -direction or both directions in case of 2D.
iii. Translation
A translation process moves every point a constant distance in a specified direction.
iv. Reflection
It is used to emulate reflective objects like mirrors and shiny surfaces.
v. Rotation
It is moving of an object about an angle. Movement can be anticlockwise or clockwise.

c) Outline the general structure of an OpenGL program and explain the use of various
OpenGL libraries.
• The OpenGL Utility Library (GLU) contains several routines that use lower-level
OpenGL commands to perform such tasks as setting up matrices for specific viewing
orientations and projections, performing polygon tessellation, and rendering surfaces.
This library is provided as part of every OpenGL implementation. Portions of the GLU
are described in the OpenGL Reference Manual.
• For every window system, there is a library that extends the functionality of that
window system to support OpenGL rendering. For machines that use the X Window
System, the OpenGL Extension to the X Window System (GLX) is provided as an
adjunct to OpenGL. GLX routines use the prefix glX. For Microsoft Windows, the WGL
routines provide the Windows to OpenGL interface. All WGL routines use the prefix
wgl. For IBM OS/2, the PGL is the Presentation Manager to OpenGL interface, and its
routines use the prefix pgl. For Apple, the AGL is the interface for systems that support
OpenGL, and AGL routines use the prefix agl.

d) Use a diagram to show the design of a color CRT monitor that uses three electron
guns.

CRTs have a conical shape and there is an electron gun or cathode ray gun at the back end of the
monitor and a phosphor screen in the front. The electron gun fires a stream of electrons towards
the display screen through a vacuum tube. This stream of electrons is also known as cathode
rays. At the middle of the monitor, there are magnetic anodes which are magnetized in
accordance with the instruction from the display controller. When electrons (cathode rays) pass
through the magnetic anodes, they are pushed or pulled in one direction or other depending on
the magnetic field on the anodes. This directs the electrons towards the correct part of phosphor
coating inside the display glass. When electrons strikes the phosphor coated screen passing
through a mesh (shadow mask or aperture grill), the phosphor lights up making a displayable dot
on the computer screen. There are three different colored phosphors (Red, Green and Blue) for
each pixel and the color of the pixel depends on the phosphor on which the electrons strike.
e) Explain how colored images are presented in raster display system frame buffer.
Vertex processor: Converts object representations from one coordinate system to another:
object coordinates --> camera coordinates --> screen coordinates. Each change equivalent to
matrix transformation.
Computes vertex colors. Primitive assembly: vertices are collected into geometric objects (line
segments, polygons, curves and surfaces) before clipping and rasterization can take place.
Clipping: we model scene and image separately, so there may be parts of scene that don't fall
within viewing volume; they are clipped out. Output of this step is set of primitives whose
projections appear in the clipping volume.
Rasterization: produces set of fragments for each object. Fragments are potential pixels: have
location in frame buffer, have color and depth attributes. Rasterizer interpolates vertex attributes
over objects (e.g. if each vertex is green, all fragments will be green; if each vertex is red, green
or blue, fragments will be spectrum between those colors.)
Fragment processing: colors of corresponding fragments are determined (may apply effect such
as bump mapping), hidden-surface removal: fragments may be blocked by other fragments closer
to the camera (remember, we're processing in order of objects sent by application program)
QUESTION TWO
a) In OpenGL explain the use of the following call back functions
 glutDisplayFunc(myDisplay)
It displays callback, Image to be drawn initially.
 glutKeyboardFunc(myKeyboardFunc)
It is called when keyboard is pressed or released.

b) Discuss the modern trends in the development of computer graphics output devices
The trends in computer graphics is given by analyzing important areas that affect the
progress of graphics like hardware, input and output devices for graphics, programming
languages, systems developments and advances in techniques and algorithms for computer
graphics. Then attention is given to new and expanded application areas for the future, as
well as some problems that will persistently confront people working in graphics.

c) Consider the translation and rotation operation below

x1 1 0 tx x
y 1 ¿ 0 1 ty - y
1 0 0 1 1
cosθ −sinθ 0
x x
y =sinθ cosθ 0- y
1 1
0 0 1

Develop composite matrices for two successive translations and two successive
rotations
 Two successive rotations.

x' cos θ −sinθ 0 x


y' = sinθ cosθ 0 y
1 0 0 1 z

P’ = R1 *R2 *P

x' cos θ −sinθ 0 cos θ −sinθ 0 x'


y' = sinθ cosθ 0 sinθ cosθ 0 y'
1 0 0 1 0 0 1 1

x' cos θ −sinθ 0 xcos θ ysinθ 0


y' = sinθ cosθ 0 xsinθ ycosθ 0
1 0 0 1 0 0 1

cos θ −sinθ 0
= sinθ cosθ 0 xcos θ − ysinθ ¿ xsinθ ycosθ ¿ 0 1 ¿
0 0 1

x'
y' = cos θ (xcosθ− ysinθ)+¿ [ −sinθ (xsinθ+cosθ) ] +¿ 0 0 ¿ 0 ¿ 0 ¿ 1¿
1 ¿

x'
cos ⁡(θ+θ) −sin ⁡(θ+θ)
y' =
sin ⁡(θ+θ) cos ⁡(θ+ θ)
1
 Two successive translations.

x' 1 0 tx x
y' = 0 1 ty y
1 0 0 1 z

P’ = T1 * T2 * P

x' 1 0 tx 1 0 tx x'
y' = 0 1 ty 0 1 ty y'
1 0 0 1 0 0 1 1

x' 1 0 tx x 0 tx
y' = 0 1 ty 0 y ty
1 0 0 1 0 0 1

1 0 tx
x tx
= 0 1 ty
y ty
0 0 1

x tx tx
=
y ty ty

QUESTION THREE
a) Sketch and explain the function of the raster scan controller
In a raster scan system, the electron beam is swept across the screen, one row at a time
from top to bottom. As the electron beam moves across each row, the beam intensity is
turned on and off to create a pattern of illuminated spots.
Picture definition is stored in memory area called the Refresh Buffer or Frame Buffer.
This memory area holds the set of intensity values for all the screen points. Stored
intensity values are then retrieved from the refresh buffer and “painted” on the screen one
row (scan line) at a time.

b) Explain the concept of window to viewport mapping and show then OpenGL
functions for performing these transformations

Window to viewport mapping is the process of mapping or transforming a 2D, world


cordite scene to device coordinates. Objects inside the world or clipping window are
mapped to be displayed. Clipping window is used to select the part of the scene that is to
be displayed. The viewport is used to display selected portion of window on the output
device.
QUESTION FOUR
a) Give a brief description of the Cohen-Sutherland line clipping algorithm
Cohen Sutherland Algorithm is a line clipping algorithm that cuts lines to portions which
are within a rectangular area. It eliminates the lines from a given set of lines and
rectangle area of interest (view port) which belongs outside the area of interest and clip
those lines which are partially inside the area of interest.

Example:

Algorithm
The algorithm divides a two-dimensional space into 9 regions (eight outside regions and
one inside region) and then efficiently determines the lines and portions of lines that are
visible in the central region of interest (the viewport).

Following image illustrates the 9 regions:

b) State three properties of affine transformations and describe OpenGL functions for
matrices management and effecting translation, rotations, and scaling
transformations.
Properties of affine transformations
a. Hyperplanes Map to Hyperplanes:
In particular, points map to points, line map to lines and planes map to planes. Also, line
segments map to line segments.
b. Parallelism is Preserved:
Two vectors which are parallel will have parallel images under an affine transformation.
c. Ratios are Preserved:
This does not mean that ratios between lengths of line segments are preserved. Ratios are
preserved in the sense of interpolation.
OpenGL functions for matrices management and effecting translation, rotations,
and scaling transformations.
Translation
A translation moves a vector a certain distance in a certain direction. It moves every point
a constant distance in a specified direction
Rotation
A rotation transformation rotates a vector around the origin (0, 0, 0) using a given axis
and angle. To understand how the axis and the angle control a rotation.
Scaling
A scale transformation scales each of a vector's components by a (different) scalar. It is
commonly used to shrink or stretch a vector

You might also like