0 ratings0% found this document useful (0 votes) 148 views24 pagesCG Unit3
computer graphics for vtu 6th sem CSE students
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content,
claim it here.
Available Formats
Download as PDF or read online on Scribd
DOCUMENT OF
ARADHYA TUTORIALS® g/GHTS RESERVED 2
pase no: Meo§S>
LONiar
INPUT AND INTERACTION -
« Interaction
+ Input dlevices 2
° Clients and Servers
* Display Mists or
* Display lists andl
9}
er opera hens
Ss
Bese input
Programa on
Menus
Pickin
A ort. program
Interactive models
eng Tnteractive Proneaes
Inkractive prprae
JMS €
This Notes is valid
'* only for the duration *
Jan-2014 to Dec-2014
(CLASSES ARE ALSO CONDUCTED
FOR EC/EEE/IT/TC BRANCH
‘SUBJEGTS @ ARADHYA TUTORIALS
This Notes is valid
%* only for the duration *
Jan-2014 to Dec-2014
9848642144 (MALLESHWARAM) 9972731111 (JAYANAGAR) 9972851111 (VIJAYANAGAR) 9901942144(INDIRANAGAR)DOCUMENTOF ARADMYA TUTORIALS® R/GHTS RESERVED pare no: 2 (-
What is meant by Interaction 7 Explain how
itis cuppovted. “by Opengb
Interaction’ > in genres reyers to tommunicaboy -
Interaction in the pied o Compulty graphies
veers = tp the ae mn whith the applicabep
program — interacts (eommunicates’) toith yiput andl
output — devices zi the See nee bul
in response b the. input pres
Opengl does not ras Intevac bon)
in ovdev ft maintain Rises,
opengr provides the gLUT rash This librony
copes intevothen — with ary ee Mereal ae
ete amd hence enah leyachon: Further
pabale with man
the LUT brary ‘
opesatin sy ettms el X windows, Mierorogt
hence corey
klindows, a ete oma
encures iy 54 ORAL
we devices 2 Explain them — wert
hci cal
What
perspective
the mame suggests
Input devites as
are such olevites which — provides input
tp the Compulty raphits appli tabren oP
The = main input olevices used to Phdenact
with C proqvoms are ke, par, mouse,
trackball” data-tadlet , i a Toystre 5 ee
(Pt-0)
Z
9845642144 (M 2 RAN
(IALLESHWARAM) 9972731111 JAYANAGAR) 9972851111 (VIJAYANAGAR) 9901942144(INDIRANAGAR)bi
b
by
Stylus
elie chavacts oF an avrat 2 chavacters
pressed » Roth these olavicees* ave ilax In
nse oma tonstrutchon- In bot ee olavites,
the motion boll is soepr¥e into signals
ome sent tb the comp. They are
velative positioning eK
Data tablet interacts Ae the program by ging
> it the position o the etylus: A iypreal
data- tablet has er omd columns ©) wires
embedtdecl on
between Wolves oma the ae Ft
om < of yoni
rhe is one ‘4 the oldest input dlovice
in Computer raph S$: Re Hght pen eontains o
light sensini olevice- Oe AR pen IS held ot the
pront } the CRT: When the _ electsvn bean
Gries the phosphor, the light emit — prem
the” (RT teavkes the —Nightpen . ‘The light sensing
et ©. the Light- pen, sends a si nil tb
ce
DOCUNENTOF _ARADAYA TUTORIALS® ics aesekveD Ba}
keyboard interacts an the prograrn by png
tthe ASCE values dhe eye pressed
the, cyprogranmmetay Po gor give. Gitte =
dheisesap meg bya This Notes is valid
+ || only for the duration *
Jan-2014 to Dec-2014
—Mouse and Trackball interact with the propre
ivin rh it the position a th, nh
S$ suyjace - The psinon py the
is gs Ted by © etectrvomagnebe ogee
sib pnb, olevice -
compulty Speciyying the positon:
“a gas6an
44 (MALLESHWARAM) 9972731111 QAYANAGAR) 99728S1111 (VIJAYANAGAR) 9901942144NDIRANAGAR)nase no: 4(28
Joystick i$ an jmput. device in which phe
otick pavvided would have 6 clagrees omens
ays the tick is in the — vetting “ posibdn’, then
there is yo change =n the curser posiben-
The jorthey the eobitk is moved sam the
vesting position, the josity the sereen lotation
thonges: The advantage o a FousheR fe that it
rg “designed = usin gnechonical — elemengs uch
as springs omd dlampers which 0, ia
to the user while — pushing it - cone mechornicall
eel is guitable ~ — Opplicatre a h as the
gugrt Simulators, cane cont roll HC :
DOCUMENT OF ARADHYA TUTORIALS® RIGHTS RESERVED.
‘Three dimensional — rmput ron as a space ball,
lases gtanner ete Can ed Sd SD pepe
“idhat__ave,__input a Sxplain them wrt
their — ogieal pe’ echive «
In aie: af the name Suggests
ant sue vices which —_paovi des input“ b the
os japhics application program The main
input ices used =o, intevact with 4 proenet
ave keyboard , "Mouse , trackball, dato- ta lel,
dares pe? ? ys ete-
This Notes is valid
* only for the duration *
Jan-2014 to Dec-2014
Logical, ers pective o) an Mmpu
seers ob looking | otf — the Input olp vice rem
the point > vier oy the — applicatb'on
progvarn « The application rq am re Inferes teal te
9845642144 (MALLESHWARAM) 9972731111 (JAYANAGAR) 9972851111 (VIJAYANAGAR) 9901942144(INDIRANAGAR)co
Ee
DOCUMENTOF _ARADHYA TUTORIALS® RIGHTS RESERVED. page
only im the measurement (data given by the
“input device) omd — time (instance at whith the
alata Is seme) of the impub device - The application
a a is mot intvakd in the. prijaicol
i tecture 4 the input — olevice -
Feom the logical perspective, there ave 6 clasces
o Pmpue poms Mth sas. >\
(i) String device _- ie o logical deviant provides
sg ASCIT tkyings ea
|] This Notes is valid
||]* only for the duration *
Jan-2014 to Dec-2014
ave
Keyboard no: le ack as a
ttring — oltvi
1 420
(Locator device _- ie NO! olevice that provides
potitoN} wold ev-ordinaks to
the . program + Mouse ov trackball
eS a a Incatos davice-
(in Piek olevite i a logical aavice that provides
Pi ES idence associate with oe
e
Qo object fon th display ), te
Ag 2 Ge ; eis troekball
user prapenon: Maus ov
e wea
ates piek olevice
() Chote _devite_-
ie a lopreal olevite using whith
the user” can vehuxn “one out
2, the numerous options fo the
usey — prpavam- Menus, sexvl)bars
omd graphital buttons can de used
y Choice input: Keyboard ov
mouse acts as a choite olevice. fF
'S4S6A2144 (MALLESHWARAM) 9972731111 (JAVANAGAR) 9972851111 (VJAYANAGAR) 9901942144(INDIRANAGAR)DOCUMENT OF _ARADHY,
() Valuaty _devite_- rs
Valuatos devite
2 the uses
Liidebars
valuator
Trackball
This Notes is valid
* only for the duration *
|] 3an-2014 to Dec-2014
(vip_Stapke device - re
retuons
the
can
a
an
ules
act
TUTORIALS® _R/GHTS RESERVED
a
cam provide
togical clave
pase no: 6(24)
which.
‘put fe
prgram . Raine and
can be used iY
impuls- Mouse
can act at’
Ingicol —olaviee
angie
ond
a valvator chvi
whieh
tons bo
mouse
clovice .
array 6
ad eey
4
e
Write
what
devite
a note
ave the
pavvides
on fnput
dipperent mo
input?
as “a: a
$
mollis 2 (0rd
in which _an-input
An input
device
devi ae
whith
uses (application) ~
ee the ier
isa
cluvice
as
i i mode |
ii ‘mple mode
(id Event mode
The olata = that = the put device ives po
the — applitatien Peer is called as the
“measure”? omd the time instance at whith
the clata is send b the cbvice to the
Progvam is called as the "“dtwigges ” ue
provide
bs Theve
can providle input
ne program: su
the name
mnput
B
applitabyn program -
ects
od the
ave modes in
ch
394862144 QLALLESHWARAM) 972731111 UAYANAGAR) Sorasill(VUAVANAGAT) D901D424QNDIRANACAR)1
DOCUMENT oF ARADHYA TUTORIAL:
Examples - The
cingle
characters
Enter key
meacure
character
wohere
oO) a
ov
as
“Jan- 2014
The = medsuse 6,
position oo the
Oe qo. tne
the’ mouse:
Example a —
pr
in whieh
to the
belovo-
The 3 modes
provide input
as chown
the
thi
@ Request mode~ In
the oevice fs mot iven
until — the olevite is
a ag C spay
am requires
the » ae Paeten rs
sean t
prog ' counters £can
pes
the
a “8 1) prog rammes
i yer Au
in the
are
the
Tae he:
as
ho xen
onl ayer
atts as
ve preenieal
a
shown
RIGHTS RESERVED.
This Notes is valid
* only for the duration *
a mouse
Cursor
applicabr
O
ocle,
dea: then the
cata that
keyboard buy yer anol
.S to the
enfer key is pressed whith
a3
page no: $(24)
Keyboanel Ts a
an arra °.
the
vigget is the
to Dec-2014 |] -
Vs — the
whereas . the
4 the ae on
ac davree can
ry yam 78
in,
the measure ob
to the prvgram
a4 veal Fox example,
ein. mpput,
it voaits
thou
entered
statement
the input
ws
wp g 5AM
can be
helvo -
pie Porvally
9845642144 ( JAY. G
(MALLESHWARAM) 9972731111 JAYANAGAR) 9972851111 (VISAYANAGAR) 9901942144(INDIRANAGAR),DOCUMENT OF ARADHYA TUTORIALS® RIGHTS RESERVED
(i) _Sampte Mode - in the mode,
= See Re ‘epon’” “as
x tall in + the prrgram
the measure 1S iven-
rs needed =i this mode -
piebori weprecen teal
ee
‘Gi Event Mode - The a geil
the request mode and
be used Mh there it
a
the
the
us
Henee
te
as
a
daviee ym whith the
taken: However ‘ee
input dvites
buttons, suoitehes
must be use
;
such
ar
os
oH pe
In thi.
unebion — wou
P
oll
#
speeiic
acepciate
he
can
below
queue it
shorn
014
[CLASSES ARE ALSO CONDUCTED
FOR EC/ EEE /IT/ TC BRANCH
|SUBJECTS @ ARADHYA TUTORIALS:
ba
shown
Joy nek,
with
« oynoput (event). The 0s voould 7, tasty
ae event queue amd @ ,
correspond yo the
pirtorially veprecente
This Notes is va
* only for the duration *
imput
unehon
(21
w%
encounrered ,
no mage
can be
below
Srqodes Ie
ate
‘mods can
pepe
to be
vane
clials,
Event mode
6.
callback
each
xetult ne
events 1
to Dec-2014
GE
mea
sony itt
wouseaaiis S
PMSGEIA (IALLESHWARAM) 9972731111 JAYANAGAR) 9972851111 (VIIAVANAGAR) 9901982144(INDIRANAGAR) |DOCUMENT OF ARADHYA TUTORIALS® RIGHTS RESERVED. page no q(SS
Write a note__on the Client -_gerver__™odel__
D execubon __2 purples pngeste =
(or)
Hoy ave Opengl application _ paogyams executed
nthe __vorkisiation - * a
The — Computer Nigries architecture is basecl on
the clitmt- server model- In this archi ve ee
building blocks ave embtves called ves P
; y the
There welded bin Hee abioiks 7S 7.
tasks af the “cliente” — wohen, ae Moveovey,
the — Gevvers omol clients an — over
a . network ox can be, € ined entireh
within A single ow This Notes is valid
* only for the duration *
Jan-2014 to Dec-2014
Tod ar ynost 0) “Phe Computing
dretvibuted andl metwork based as chown helow-
gerne
serves
oe
ent é
- dient
7 vices
The gvaphits server can provide output servi!
on ‘ display and input services through as
keyboayd and the — pointin olavice- These series
ave available tb the clients anywhere On the
network-- Inject even iy we have a .simple user Feolerkedl
Lsystem, the’ imievath'on vwoutel be congiqured as client-server mp
9845642144 (MALLESHWARAM) 9972731111 JAYANAGAR) 9972851111 (VJAYANAGAR) 9901942144(INDIRANAGAR)DOCUMENT OF _ARADHYA TUTORIALS® RIGHTS RESERVED. page no: 10 (24
What __are Display Lists ? Explain with examples -
Display lists as = the name = Suggests — are
used tp stove the dleseviphon © i. objects
whith are’ be dlisprayeol on the moni frr-
The — deceriph’ons would inelucle —-verh'ees, allwdults)
viewin ingormation ere Display Wests ave usecl
to overcome the linttation ses with
Tmmediate mode epee
Nowmally, there Se, ae
objects can be diplaged & monitoe -
They) are pa
(1) Immediate Mode
(1) Retained or Display iets)
_Trmmediate__ mode — che “such a mode in whieh
“as goon ac OF prvgvam execukts that
qn — ind yelayed to the primitive)
the ve (object) is sent to ne :
ee lisp pay: No memory oy it 18
poet Celient) to rmpulty-
43
a
execupoyn act
2 wequires Jett rey
Me.
dvs edisplayin: wimitve a ayy
ee dear! ‘he une oy to ap ie
at a! mew position on the slecen,
the client = eomputey mush: vesend
he Bees °} the PER
lagain
__trapyie _dehowen client and: aenver inereases
9845642144 (MALLESHWARAM) 9972731111 JAYANAGAR) 9972851111 (VIJAYANAGAR) 99019421.4(INDIRANAGAR)
This Notes is valid
\« only for the duration *
Jan-2014 to Deo%2014aN
DOCUMENT OF _ARADHYA TUTORIALS® wcnrTs RESERVED page no: wen
tained Mode- is used ty overevme the limitatioh
— @8soerattd with the Tmmediate mode. The
Retained Mode makes use Of the ditphy
Iiete. The — arehitectuve in the — Retained
mode re as shown below -
This Notes is valid
* only for the duration *
Jan-2014 to Dec-2014
As noted above, the Ser desines the
object once omd sede, - erver. Seqver, phtes it
in -@ dreplay le ‘a deploy Hist which
it stored © in ervey can be cre-dlitphyl
by) a — simple Apion call fram the
client Choet). the aoa E re” that onl
a qunetim call pas “to be Made-
entive ol hone) the §=pmmihve nee
mot ee } e
Feplay wete- can be created m a
ey as an other
ometaie — puimitive rs seated - However,
the entire olesemphon = rs enclpcedl
behoeen tNelist 6D amd glendlList ed
ac shown © below Further each aisplaydieh
would have an unique idenfyey
associated with it: It can “be done
using a -# degin @ divechve as shown
belovo - , epr-ay he
9845682144 (MALLESHWARAM) 9972731111 JAYANAGAR) 9972851111 (VIJAYANAGAR) 9901942144(INDIRANAGAR)DOCUMENTOF ARADHYA TUTORIALS® RIGHTS RESERVED. i ge no: 19 (24)
etino BOK 1 /+ oF some other vnveod intoger +/
nosList(@0x, ¢l,COmerLe)
nbepin(ci_POLveod:
sie coler3E(3-0, 0.0, 0.0); be Notes Is valid
only for the duration *
Jan-2044 to Dec-2014
fach time the élient wishes ty wedlvavo the
box on the olisplay, re neo not recend
the entire cleseniptian - Rothe ; it I hag to
moke at puneben call as ae lpi ~
gueatibict (80x) : ats
The Box can be made se" al aligyrent
places O17 tape "a chan ging the
projection mmatHx me sini:
Aes, [CLASSES ARE ALSO CONDUCTED
iS; hee) FOR EC/EEE/IT/ TC BRANCH
SUBJECTS @ ARADHYA TUTORIALS
gileadidenesty0
Ww0rth29(-2!0%4 , 2.064 . -2.0%4 , 2.084 95
glcalitiee eax)
>
However ye qe programming prachiee,
H fe benty” to push both the
anes x3 ond the matwces ponte thers
using LPushARaib(> andl
Tes @ etatks
guPushMataix() - Apter the execubon 0} the
display tisk, the covretprnding pop prep
mutt be perpormedd as shown below -
9845642144 (MALLESHWARAM) 9972731111 (JAYANAGAR) 9972851111 (VIJAYANAGAR) 9901942144(INDIRANAGAR)c@s
DOCUMENT OF ARADHYA TUTORIALS® _RiGHTs RESERVED page no: 13(24
Adv Reduces the trope behoeem the
client and — the Servey -
+ allows much o) the oveshead in
executing. commands to be done onte
SS) and Have the results etved in the
display fists on the sewer. Hence
‘redisplays become §=move oe
Disadv * ‘vequires more wy seer
a
o there is oN
enatiing a et
£
Explain how _an__ Event on imput can be
prvgrammed we a pointing clevice - \
Pointin, devices ave guch dlevicee whith
allowo the pry =. t indicate a position
on the dit - Mouse, Trackball, data-todlet ete
“can be as pointing oliviees
A et ceveyit fs enerated — when oe
the use butlins ic —eithey = pprecced’ ox veleased-
The imyymation yeturned (given) fp the
program - when ahGS ond pecure — vovuld
include the bulton — that ees the event,
the state 9} the — button, the" position (7,4) ?}
the cursory when the i
Tnvolved in
This Notes is valid
* only for the duration *
Jan-2014 to Dec-2014
9845642144 (MALLESHWARAM) 9972731111 (JAYANAGAR) 9972851111 (VIJAYANAGAR) 9901942144(INDIRANAGAR)DOCUMENT OF ARADHYA TUTORIALS® _R/GHTS RESERVED . page no: 14(2s)
Programmin a Mouse event involves 9 cteps-
ot + oe reeere callback uneton must
be period in the main pensten
as | shown belo ~
}CLASSES ARE ALSO CONDUCTED
FOR EC/EEE/IT/TC BRANCH
SUBJECTS @ ARADHYA TUTORIALS |
HC. Chae sang)
‘
sictase Charge,argy)
Owctesevindotiae( ey, WM); /+ globally detlond initist window size «
slutInitDisplayMode(GLUT_SINGLE | GLUT_ncA); :
Sieg
See “>
ay i Peace aed ay
.
2 moute ek unchon must
Step -D => The ss
he _dleyinecl ase Noon below -
eee
void mytouse(ine button, int state, int x. tne 7)
Af (Outten => GLUT_LEFT SUTTON kk state = GLUT_Dow)
exte(0)
=
The A ate ensures that
the ley mouse button is
ted clown’, the prrgram voouldl
SMiminate “The mnoust callback _ pergn
QP seriay ata. be clyyrneel as "chown
below - This Notes is valid
* only for the duration *
wold ayMlowseCsne ben, snt state, int x. tnt y) 2n;2024 \(pe0;2014
t
‘t(btne-GLUT_LEFT_BUTTOM AE stater-CLUT_DOW) drausquare(x.
‘t(bta-GLUT RIGHT AUTTON 28 atate==CLUT_OWN) exit)
,
The above . deyinitton encures that the pees
nbn ereats boxes at the tocation—
oy, gt be :
here te currsey is present amd the press op
9845642144 (MALLESHWARAM) 9972731111 (JAYANAGAR) 9972851111 (VISAYANAGAR) 9901942144(INDIRANAGAR)Coa
DOCUMENT OF ARADHYA TUTORIALS® RIGHTS RESERVED
aren: 1508)
the right button would = tevminate the program -
The 4. inition the mouse callback “junction
can be pr rammed ~ b the “programmer
ateording to the
Tequize ments % his
applications .
Explain __how __an__Event __daiven input can be
Programmed a keyboard —_olevite -
7 >\ ;
Keyboard oe which
i devices ave ee
the prvgrammey to giz ASCII
volue fo the “user pavgram- fon dar ol
peyhonre can be uced i ee keyboaral device.
A __Keyboard event CQrrevated when one
3 the Ree} e ape is pyesteal. The
inpormation xetusned (given) to the progeam by
the ne ee ‘would “jnelude the Asciz value
° th
key pve ancl +he position (mp ».
wh Curse ic ae was presced. ,
Pro’ re) Kepboarnd event involves a sips
gte The keyboard _callbock junettan must
be aregitlere3t in the’ mam gunction
Ge lane ie” letienmeee
‘hs /* globalty defined initial vinlow ize «/
UT_SINGLE’ | GLUT- ROS);
9845642144 (MALLESHWARAM) 9972731111 (SAYANAGAR) 9972851111 (VUAYANAGAR) 9901942144(INDIRANAGARYDOCUMENT OF ARADHYA TUTORIALS® RIGHTS RESERVED
etal
Step => The — keyboavd. callback por must
be
be deine as shown
oid apfey(onsigned char Key, sat, Int 7)
Dpto -
ttneyeeg? HN may == °Q") exit Ds
[CLASSES ARE ALSO CONDUCTED
FOR EC EEE /\T/ TC BRANCH
SUBJECTS @ ARADHYA TUTORIALS
The above dleynition ensues that when
i the 2p oyg ke wn. the keyboard
is pressed $ the execution e
program gtts terminated - ey the
prqvammey 6a design “ mi ben (body
e
oy the — callback pace SW randy to the
vequisements ey his, op) Nitatven pavgram:
Explain how __an en _Imput can be
Window Events 9 be treated ob pointing
Gevreecs. A window event is said fo have occured,
7 by st » a corner aey the
window is AYA dt a mew position ey by
using se the sire a) the window 78
smininpl oF rome whenever the window
event) rs generat. Piaty ht and width ov
the new — window would” be “vetuvned to the
prvgram
This Notes is valid
* only for the duration *
Jan-2014 to Dec-2014
CP TO)
9848642144 (MALLESHWARAM) 9972731111 JAVANAGAR) 9972851111 (VIJAYANAGAR),9901942144(INDIRANAGAR)—2OCUMENTOF ARADHYA TUTORIALS® nicHTs RESERVED
Programming the Window vent involves
ftp 1 => The window callback unehen must de.
ee
eeed = im the ~=— main Beane ag
Shown below -
page no: 17
Q@ steps -
[CLASSES ARE ALSO CONDUCTED
. FOR EC/EEE/IT/ TC. BRANCH
SUBJECTS @ ARADHYATUTORIALS
get Reshape yume (mmyReshape) 5 _
This Notes is valid ONS
|]* only for the duration *
[Jan-2014 to Dec-2014 |! yy
Step 1 > The window call bk yunebion must
be dnyined as Ps blow ~
pes mngtelp> Casi wo, ee h)
Lmataix Mode C4.-proseeTI oN)
ne igen Ten ae
x g toathe2d (2-o,(gtdoubied™» ove, ftdeudtea
ey glMatararrde (gt tedeivicr);
e j
jhe obove — deyinitton encures that the
Preection matex ome the — view mateix *
adjusted such phat the same aspect
ratio is gaintained- However, the
Programmer can design the olarnition (vod
oh the Window callback gunttien actpndling
tb ™ +
the wequivements 8} his pxagre
(VIJAYANAGAR) 9901942144(INDIRANAGAR).Wvite a _nole__on how menus can be created
Menus are an im portant jeature 0) ane
fe }
Applitatien — puvgyam. Opensi psovidee a jeatuye cated
‘pop-up- menus” ating ‘hich sophieHeaked “interactive
applicatione can be created -
Creating and using Menut involve ™ gy elepe -
G) Create a = =omenu with a m and add
entyies into the menu S\
Lmk the = =menu tp « Dereeponding
mouse button
cn) Deyine the agef Stig to each
entny in oD enu -
mptemented ac shown below -
"reate Menu (olemo- menu) 3
SS WtAdd Menu entry (quit, 2°) 3
lutAdd Menutmeay “CH mereace size", 2) 3
oO githddenusntry C+ cleerease sive*, 3);
“
(
Sltp-T is
Step-D ig implemenied as shown — below ~
grutmachotem u (pvt Rig HT_BUTION ) 3
This Notes is valid A
ly for the duration Be
an-2014 to Deo-2014 CPT)
POCUMENT OF ARADMYA TUTORIALS® uGuTs RESERVED tase 00:12 (24)
‘ANAGAR) 9972851111 (VLIAYANAGAR) 9901942144(INDIRANAGA:
R)C63
DOCUMENTOF ARADHYA TUTORIALS® RIGHTS RESERVED. nage no: /4(24)
Step-M _ - “can be implemented as chown Seloo-
vid demo menu (int id) [Tetasses ane also ConDucre
i: FOR EC/EEE/IT/TC BRANCH
cwiteh (id) ‘SUBJECTS @ ARADHYATUTORIALS
i cage 4: exit(od ;
break ;
case a: £ige = ok Sine;
break ; J
<~
case 3; ye" >a) of
ge alzo— gupposts the creation 0} Hievovehial
menus af sh ~~ below -
(ode
This Notes is valid
* only for the duration *
Jan-2014 to Dec-2014
Autcroatetema (size
gluthadtenutntry("Inerease equare
BlutAddtenutotry(Decteace square
elutcrestatens (top. seos);
‘9972731111 (JAYANAGAR) 9972851111 (VIJAYANAGAR) 9901942144INDI@ AWae= 4
9845642144 (MALLESHWARAM)DOCUMENT OF SRADHYA TUTORIALS® RIGHTS RESERVED. page no: 20(2
BUILDIN: INTERACTIVE Mopils =>
Using Opengl, not
twoheve we can clo rnanipulation|
only ~ psvgvarns
SEM dekebon ete can de olecignedl. we
can also build euch — pregrams whith ave
quiet interactive “b usin the comeepl of
inatancing ome display lists -
interior cles; he has ikem)
lonsider an Eppicanenlnd “eS
tables omd othox —rouce hold He isi
s he
ave called the basic build?
application... ach — weeurence oe - iHems
rs repre tae
As and when Scher eso) building
blocks are — eweateal the — applrcat’on
prvgeam, the He es is shored into
an ara catled Dy the “jnetance table” . We
sreserve the o tw specpy thal The object
1 longer Ras (te pr delebion Puopree )
ma Spe thot ‘the user has indicated
bg Ne menu that he wishes to eliminate
eject amd “usec the ‘moure to Jocate
ih gkject- The program can now seach the
instance table oe om the Pye object Fil it
pirds tre object OS Speer jel in the boundi
to 0- Hence
box omd then set its type
the — ext time the display prvcess goes
thaough the instance table , the. object woould
“mot be dlisploiyecl oma ~“hente appears to have been|-
Pav (lacie
‘WBASE42144 i
(HALLESIWARAMD 997279111 GAVANAGAR) 7285111 (VUAYANAGAR) 9901982144QNDIRANAGAR)>
bOCUMENTOF ARADHYA TUTORIALS® f/GHTS RESERVED page no: Q1(2)
ey the above strategy EEE a
betes’ datactvuctuye % imphkment the
Inctance toble is using linked ists instead 9,
arrays - Sach new instance would add a
ced sehlta node tp the. Jinked list: |
Deleting an inctomee (such 0s 0 chair) rout
amount fo —tvoversing the list amd alaleing
Cyraing) the — corresp aro noole -
ANLMATING INTERACTIVE eegh ts
Using Open gu pane Gorm can
geian Mmitvachve per ra chive programs
ore Such — pavgrams i hich objects ave
mot atatic: Rather AN, ap, cas «=otp «be
‘movin by anon Consider the poles
dagen
Consides a
re Cosd
Yo sind
This — point would lie on a unit circle
egavelless a the value Bh ©. Thus 4 we
564861144 (IALLESHWARAM) 9972 7BI111 GAYANAGAR) 97285111 (VUAVANAGAR) 9901912144(0NDIRANAGAR)DOCUMENT OF ARADHYA TUTORIALS® RIGHTS RESERVED page no: Q2(2z
Connect, the above gen 4¢ points we gst
a equare whith has ite cents as the
ovigin- The above - squaxe can be displayed
as shown —belbwo -
This Notes Is valid
}* only for the duration *
Jan-2014 to Dec-2014
void dieplayO
Clear (GL COLOR BUFFER_BIT?;
ibegin(GL FOLYEO ;
thotar theta/(3,14169/100.0); /+ convert degrees to radian> «/
& 9 cos(thetar)
a(t
flvertez2t(ein(thetar), -cos(thetar))
aad; AS
, OS
[CLASSES ARE ALSO CONDUCTED “\
FOR &C/ EEE /IT/ TC BRANCH S\
SUBJECTS @ ARADHYA TUTORIALS. >
Suppose thet we Se the a oh oO
ns nin he square
as the pregxam
he
mer “b apg hye onigin. IH
a is be wet ed a, pized
ne
value 0) ©
amount whenever nothin, diss Beni
then an iy callback unetion ‘musk be
desig neck ¥&v Shown below -
Q
se eo
steheta >» 960.0 theeeneaeo'o
elutPortRedisptayO, i
>
The above ‘idle callback unchion must be
vepisteved in the "main punetion as -
glutidle Fune (idle)
‘9845642144 (MALLESHWARAM) 9972731111 GAYANAGAR) 9972851111 (VIJAYANAGAR) 9901942144(1NDIRANAGAR)ca
DOCUMENT OF ARADMYA TUTORIALS® RIGHTS RESERVED page no: OBO;
Suppose that we want tb tan a and tysn on)
the — -yvtatien re then we can write 0
mouce callback” junction as shown — below ~
void mouse (int button, int state, int This Notes is valid
{ “i> Il only for the duration *
‘roemroeceur tert prowsstate~civtoom |! Jan.2014 to Dec-2014
| eee teak ee ee ee
eo.
The above mouse callback mg starts the
r lepe mouse
yolation =o) the tube here
button is pressed = when «O a, bulton is
pressed re pats eRecutlon . However the
_abpve given mouse ax pmetion must be
registered ‘m the i jot as shown
bell
vO ~
. i (mouse) ;
However, ae the above Pregram 15 @ ‘uted
ie se ad scheme then jliskemang
reed on the lis play . This
this can be — ovescome using — the comcept
D
uble bypring :
i ou tls Notes is valia
only for the duration *
4an-2014 to Dec-2014
4
(tithe
Double buyjerin ye Aust onary nem animatons
where the — paimitves, allvibutes amd wiewin
tonditons are continuous ly changing. Double
buypeoing mode can be. In Halige od usin
glutDnit Ditplaytfode ( gLUT- fe) GtP7-DovBlé) hm the main~
9845642144 (MALLESHWARAM) 9972731111 GAYANAGAR) 9972851111 (VUAYANAGAR) '9901942144(INDIRANAGAR),DOCUMENT OF ARADHYA TUTORIALS® RIGHTS RESERVED < pave no: Qbs(245
punetion. Further in the display gunctien ,
we have to add - the stakment
eae pe >
Usin this apprvach, — the problems acsociated
with pltker can be elim nated -
This Notes is valid
*only for the duration
Jan-2013 to Dec-2013
es
sug
iy
|] This Notes is valid
| * only for the duration *
|| 22n-2014 to Dec-2014 |
‘ABC for Java and Testing
‘Arachyas Ballance Centre for java and testing is a
sister concern of Arachya tutorial. We provide
ualty industry oriented taining for final yeer
‘Students and freshers. We also provide immense job
|CLASSES ARE ALSO CONDUCTED
FOR EC/EEE/IT/TC BRANCH
‘SUBJECTS @ ARADHYA TUTORIALS,
997RTSULL GAYANAGAR) 9972851111 (VIJAVANAGAR) 9901942144(INDJRANAGAR)