point burst
TRANSCRIPT
-
8/17/2019 Point Burst
1/30
Visvesvaraya Technological University,Visvesvaraya Technological University,
Belgavi, Karnataka-590 014Belgavi, Karnataka-590 014
Project report on
POINT BURST POINT BURST
Submitted in partial fulllment of the requirement for the award of thedegree of
Bachelor of Engineering
In
Computer Science & Engineering
Submitted by
ABDUL A!""B #$
%1&'1('!001)
Under the guidance of
DEEPAK N.A
HOD (Dept. of CSE)
Department of Computer Science & Engineering
Ghousia College of Engineering
Ramanagaram –56215
!"R#"$"!"
GHOUSIA COLLEGE OF ENGINEERING
-
8/17/2019 Point Burst
2/30
RAANAGARA!"#$%"
This is to certify that Mr. Abdul Haseeb P.
have satisfactorily completed the mini proect on
#*+T BU!T that has been approved as it
satises the academic requirement in view of the
proect wor! prescribed for partial completion of the "th semester #.$. degree in %omputer Science
course awarded by the &isvesvaraya
Technological 'niversity( #elgavi in the year
)*+,-)*+".
Signature of
the
'"T+.+'A
T"
Signature of
the
-
8/17/2019 Point Burst
3/30
ABS'RAC'
%P'#$ ()RS$* is a simple an+ user frien+l, graphics mo+el -ase+ on .in+o/s
platform0 /hich +emonstrates the ho/ to ren+er particle effects /ith openG " clou+ of
pin3ish4orange particles eplo+es /ith the particles -ouncing off the groun+
$his project is small0 simple in construction an+ is interactie 't uses the in7-uilt
functions in glut proi+e+ un+er the openG $he project +emonstrates the particle effects0
/hich inclu+es features li3e eplo+e0 -ouncing effect an+ spin or rotation of the surface
$he project also sho/s that /hen the SG'S8point8parameters is present0 the particle
si9e is attenuate+ -ase+ on e,e +istance :ouse is proi+e+ to rotate the surface an+ to select
the option -ase+ on the menu entr,
-
8/17/2019 Point Burst
4/30
AC(NO)LE*GEEN'
$he satisfaction that accompanies the successful completion of an, /or3 /oul+ -e
incomplete /ithout naming the people /ho ma+e it possi-le through their gui+ance an+
encouragement /hich resulte+ in a perfect /or3 ;irst an+ foremost0 /e /ant to than3 the
almight, that actiates us in each an+ eer, secon+ of our life to complete this project /or3
successfull,
'ts our pleasure to epress our +eep sense of gratitu+e an+ /hole hearte+
ac3no/le+gement to *r+ ohame, Haneef 0 Principal of GCE an+ our -eloe+ r+ *eepa-
N+A0
-
8/17/2019 Point Burst
5/30
'ABLE OF CON'EN'S
Chapter .age
1. INTRODUCTION
1.1 About Computer Graphics 1
1.2 About Opengl API 2
1.3 About project 3
2. SYSTEM REQUIREMENTS
2.1 Software Requirements 4
2.2 Hardware Requirements 4
3. DESIGN
3.1 High Level Design 5
3.2 Algorithm 9
4. IMPLEMENTATION
4.1 Pseudo code 10
5. SNAPSHOTS 12
CONCLUSION AND FUTURE ENHANCEMENTS
-
8/17/2019 Point Burst
6/30
APPENDIX
REFERENCES
C on the screen (itmap graphics proi+e eas,7to7use an+ inepensie graphics
-ase+ applications
$his allo/e+ users to s/itch among multiple actiities just -, pointing at the +esire+
/in+o/0 t,picall, /ith the mouse Graphics proi+es one of the most natural means of
communicating /ith the computer0 since our highl, +eelope+ 2D an+ AD pattern –
recognition a-ilities allo/ us to perceie an+ process pictorial +ata rapi+l, an+ efficientl, 'n
man, +esign0 implementation0 an+ construction processes0 the information pictures can gie
is irtuall, in+ispensa-le
-
8/17/2019 Point Burst
7/30
'nteractie Computer Graphics is the most important means of pro+ucing pictures
since the inention of photograph, an+ teleision0 (, ma3ing communication more efficient0
graphics ma3es possi-le higher7Bualit, "n+ more precise results or pro+ucts0 greater
pro+uctiit,0 an+ lo/er anal,sis an+ +esign costs
%+$ A/out OpenGL
't is a Soft/are 'nterface to Graphics
-
8/17/2019 Point Burst
8/30
• Eas, to use
• Close enough to the har+/are to get ecellent performance
• ;ocus on ren+ering
• mitte+ /in+o/ing an+ input to aoi+ /in+o/ s,stem +epen+encies
%+1 A/out .ro2ect
%+1+% .ro2ect Statement
1> $his program is an openG application /hich is eecute+ using isual C
2> " ;loor /ill -e create+ -ase+ on the teture an+ pattern proi+e+
A> :enu is proi+e+ to the user for selecting the appropriate option
F> $he clou+ of points eplo+es from the surface -ase+ on option selecte+
5> $he point si9e can -e increase+ as /ell as +ecrease+
6> $he surface color an+ pattern can -e change+ -, altering the RG( parameters
an+ input +esign respectiel,
> $he other characteristics of points are -len+ of the point an+ smoothness
%+1+$ Input
'nput to this program is mouse
:ouse is use+ for selecting the options proi+e+ an+ spin the surface manuall,.
%+1+1 Output
utput is nothing -ut eplosion of particle /hen it hits the groun+ the point -ounces up/ar+
repeate+l, an+ gra+uall, the elocit, +ecreases an+ the particle comes to +ea+ state or
anishes
-
8/17/2019 Point Burst
9/30
%+1+3 Goal
Demonstrates ho/ to ren+er particle effects /ith penG " clou+ of pin3ish4orange
particles eplo+es /ith the particles -ouncing off the groun+ .hen the
SG'S8point8parameters is present 0 the particle si9e is attenuate+ -ase+ on e,e +istance
C
-
8/17/2019 Point Burst
10/30
• :icrosoft Jisual Stu+io 2K $his soft/are pac3age containing isual -asics in c
language is reBuire+
• PE#G "P' is use+ /ith G)$
CHA.'ER 1
*ESIGN
1+% High Le9el *e0ign
1+%+% Bloc- *iagram
-
8/17/2019 Point Burst
11/30
Fig 1+%+ Bloc- *iagram of .oint Bur0t
1+%+$ *ata Flo6
-
8/17/2019 Point Burst
12/30
Fig1+$ *ata Flo6 *iagram of .oint Bur0t
-
8/17/2019 Point Burst
13/30
1+%+1 Flo6 chart
-
8/17/2019 Point Burst
14/30
Fig 1+$ Control Flo6 of the .oint Bur0t
-
8/17/2019 Point Burst
15/30
1+$ ALGORI'H
Step 1 Start
Step 2 LCreate an+ 'nitiali9e the output /in+o/M
glutCreate.in+o/= > func is calle+
Step A Lutput /in+o/ consisting of initial setup of h,+ro po/er plant is +ispla,e+M
$he +ispla,= > function is calle+
Step F $he Points /ill (urst ut
Step 5 L:ouse is use+ to interact /ith the userM
'f Right -utton is presse+ then
glut:ouse;unc= > function gets calle+
Step 6 options /ill proi+e necessar, changes
Step Stop
-
8/17/2019 Point Burst
16/30
CHA.'ER 3
I.LEEN'A'ION
3+% .0eu,o Co,e
int main=>
N
'nitialises G)$"rguments from main are passe+ in an+ can -e use+ -, the application
ReBuests a +ispla, /ith properties in mo+e
Specifies the initial height an+ /i+th of the /in+o/ in piel
Specifies the initial position of the top7left corner of the /in+o/ in piel
Creates a /in+o/ for +ispla,Calls-ac3 the follo/ing functions
glut:ouse;unc=>
glut:otion;unc=>
glutJisi-ilit,;unc=>
O
oi+ input:ouse= int -utton0 int state0 int 0 int , >
N
$he press of the right mouse -utton pauses the program
'f the user clic3s on the /in+o/ using left -utton0 surface can -e rotate+
O
oi+ :ouse;unc=>
:
Calls -ac3 the mo+ule mousefunc=>
O
oi+ :otion;unc=>
N
sets the motion an+ passie motion call-ac3 for Current /in+o/
O
oi+ Jisi-ilit,;unc =>
N
sets the isi-ilit, call-ac3 for the current /in+o/
Ena-les the openG features such as
G8DEP$
-
8/17/2019 Point Burst
17/30
G8P'#$8S:$<
O
Void makepointlist()
{
Points are created
Angle and Direction of point after bursting is mentioned
Velocity of the bursted points is calculated
}
Void updatepointlist()
{
Point velocity and gravity is calculated repeatedly
If the point exceeds the edge limit it goes on invisible
Point spin and motion is called continuously
}
Void idle()
{
Updatepointlist() is called
Angle and rotation of point is updated
P'#$ ()RS$
Source Co+e
/include 0stdio.h1/include 0stdlib.h1/include 0string.h1/include 0math.h1 /include 0234glut.h1
/ifndef M5P6/dene M5P6 7.+8+,9)",/endif
/if */undef 235S26S5point5parameters/endif
static 23:oat angle ; -+,*<static int spin ; *<static int moving( begin<static int newModel ; +<
static :oat time
-
8/17/2019 Point Burst
18/30
int linear=iltering ; +<
static 23:oat constant>7? ; @ +4,.*( *.*( *.* <static 23:oat linear>7? ; @ *.*( +4,.*( *.* <static 23:oat quad>7? ; @ *.),( *.*( +4"*.* <
/dene MAB5PC6DTS )***
static int numPoints ; ,**<
static 23:oat point3ist>MAB5PC6DTS?>7?<static 23:oat pointTime>MAB5PC6DTS?<static 23:oat point&elocity>MAB5PC6DTS?>)?<static 23:oat pointEirection>MAB5PC6DTS?>)?<static int color3ist>MAB5PC6DTS?<static int animate ; +( motion ; *<
static 23:oat colorSet>?>8? ; @ @ *.F( *.)( *.8( *., (
@ *.G( *.*( *.F( *., ( @ +.*( *.*( *.*( *., ( @ *.9( *.7( *."( *., ( @ +.*( *.8( *.*( *., ( @ +.*( *.*( *.,( *., (<
/dene D'M5%C3CS IsiJeof IcolorSetK4siJeof IcolorSet>*?KK/dene E$AE ID'M5%C3CSL+K
/if */dene ADECM5AD2$Ilo( hiK IIloK L Ihi - loK drand8GIKK/else
static :oat :oat5randIvoidK @ return randIK 4 I:oatK ADE5MAB< /dene ADECM5AD2$Ilo( hiK IIloK L Ihi - loK :oat5randIKK/endif
/dene M$AD5&$3C%6TN 7.*/dene 2A&6TN ).*/dene T6M$5E$3TA *.*),/dene $E2$ +)
void ma!ePoint3istIvoidK@ :oat angle( velocity( direction< int i<
motion ; +< for Ii;*< i0numPoints< iLLK @ point3ist>i?>*? ; *.*< point3ist>i?>+? ; *.*< point3ist>i?>)? ; *.*< pointTime>i? ; *.*< angle ; IADECM5AD2$I"*.*( F*.*KK M5P64+G*.*< direction ; ADECM5AD2$I*.*( 7"*.*K M5P64+G*.*< pointEirection>i?>*? ; cosIdirectionK< pointEirection>i?>+? ; sinIdirectionK< velocity ; M$AD5&$3C%6TN L ADECM5AD2$I-*.G( +.*K< point&elocity>i?>*? ; velocity cosIangleK< point&elocity>i?>+? ; velocity sinIangleK<
color3ist>i? ; randIK O D'M5%C3CS
-
8/17/2019 Point Burst
19/30
void updatePoint3istIvoidK@ :oat distance< int i<
motion ; *< for Ii;*< i0numPoints< iLLK @ distance ; point&elocity>i?>*? time<
point3ist>i?>*? ; pointEirection>i?>*? distance< point3ist>i?>)? ; pointEirection>i?>+? distance< point3ist>i?>+? ; Ipoint&elocity>i?>+? - *., 2A&6TN pointTime>i?KpointTime>i?<
if Ipoint3ist>i?>+? 0; *.*K @ if Idistance 1 $E2$K @
color3ist>i? ; D'M5%C3CS<continue<
point&elocity>i?>+? ; *.G<pointTime>i? ; *.*<
motion ; +< pointTime>i? L; T6M$5E$3TA< time L; T6M$5E$3TA< if Imotion QQ spinK @
if IrepeatK @ ma!ePoint3istIK< else @ glut6dle=uncID'33K<
void idleIvoidK@ updatePoint3istIK< if IspinK @ angle L; *.7< newModel ; +<
glutPostedisplayIK<
void visibleIint visK@ if Ivis ;; 23'T5&6S6#3$K @ if Ianimate QQ Imotion RR spinKK @ glut6dle=uncIidleK< else @ glut6dle=uncID'33K<
void recalcModel&iewIvoidK
-
8/17/2019 Point Burst
20/30
@ glPopMatriIK< glPushMatriIK< glotatefIangle( *.*( +.*( *.*K< newModel ; *<
void redrawIvoidK@ int i<
gl%learI235%C3C5#'==$5#6T R 235E$PTH5#'==$5#6TK< if InewModelK recalcModel&iewIK<
glEepthMas!I235=A3S$K<
gl$nableI235T$BT'$5)EK<
gl%olor7fI*.,( +.*( *.,K<
gl#eginI235'AESK< glTe%oord)fI*.*( *.*K< gl&erte7fI-$E2$( -*.*,( -$E2$K< glTe%oord)fI)*.*( *.*K< gl&erte7fI$E2$( -*.*,( -$E2$K< glTe%oord)fI)*.*( )*.*K< gl&erte7fI$E2$( -*.*,( $E2$K< glTe%oord)fI*.*( )*.*K< gl&erte7fI-$E2$( -*.*,( $E2$K< gl$ndIK<
glEepthMas!I235T'$K<
glEisableI235T$BT'$5)EK< gl#eginI235PC6DTSK< for Ii;*< i0numPoints< iLLK @
if Icolor3ist>i? ; E$AEK @ gl%olor8fvIcolorSet>color3ist>i??K< gl&erte7fvIpoint3ist>i?K< gl$ndIK<
glutSwap#uersIK<
void mouseIint button( int state( int ( int yK@ if Ibutton ;; 23'T53$=T5#'TTCD QQ state ;; 23'T5ECUDK @
moving ; +< begin ; < if Ibutton ;; 23'T53$=T5#'TTCD QQ state ;; 23'T5'PK @ moving ; *<
void mouseMotionIint ( int yK@
-
8/17/2019 Point Burst
21/30
if ImovingK @ angle ; angle L I - beginK< begin ; < newModel ; +< glutPostedisplayIK<
void menuIint optionK@ switch IoptionK @ case *V ma!ePoint3istIK< brea!< case +V gl$nableI235#3$DEK< brea!< case )V glEisableI235#3$DEK< brea!<
case 7V gl$nableI235PC6DT5SMCCTHK< brea!< case 8V glEisableI235PC6DT5SMCCTHK< brea!< case ,V glPointSiJeI).*K< brea!< case "V glPointSiJeI8.*K< brea!< case FV
glPointSiJeIG.*K
-
8/17/2019 Point Burst
22/30
WXX................W( WXX........W( WX........W( WX......W( WX....W( WX....W(
WX....W( WX....W( WX........W( WX........W( WXX........W( W.......................W( W...............................W( W...............................W( W...............................W( W...............................W(<
static void ma!e=loorTetureIvoidK@
23ubyte :oorTeture>+"?>+"?>7?< 23ubyte loc< int s( t<
loc ; I23ubyteK :oorTeture<
for It ; *< t 0 +"< tLLK @ for Is ; *< s 0 +"< sLLK @ if Icircles>t?>s? ;; YYK @
loc>*? ; *+f< loc>+? ; *+f< loc>)? ; *Gf<
else @
loc>*? ; *ca< loc>+? ; *ca< loc>)? ; *ca< loc L; 7<
glPielStoreiI235'DPA%Z5A362DM$DT( +K<
if IuseMipmapsK @ glTeParameteriI235T$BT'$5)E( 235T$BT'$5M6D5=63T$(
23536D$A5M6PMAP536D$AK< glu#uild)EMipmapsI235T$BT'$5)E( 7( +"( +"( 2352#( 235'DS62D$E5#NT$( :oorTetureK< else @ if Ilinear=ilteringK @ glTeParameteriI235T$BT'$5)E( 235T$BT'$5M6D5=63T$( 23536D$AK< else @ glTeParameteriI235T$BT'$5)E( 235T$BT'$5M6D5=63T$( 235D$A$STK< glTe6mage)EI235T$BT'$5)E( *( 7( +"( +"( *( 2352#( 235'DS62D$E5#NT$( :oorTetureK<
int mainIint argc( char argvK@
-
8/17/2019 Point Burst
23/30
int i<
glut6nitIQargc( argvK< glut6nitEisplayModeI23'T52# R 23'T5EC'#3$ R 23'T5E$PTH R 23'T5M'3T6SAMP3$K<
for Ii;+< i0argc< iLLK @
if IstrcmpIW-nomsW( argv>i?KK @ glut6nitEisplayModeI23'T52# R 23'T5EC'#3$ R 23'T5E$PTHK< printfIWforcing no multisampling[nWK< else if IstrcmpIW-nomipmapsW( argv>i?KK @ useMipmaps ; *< else if IstrcmpIW-nearestW( argv>i?KK @ linear=iltering ; *<
glut%reateUindowIWpoint burstWK< glutEisplay=uncIredrawK< glutMouse=uncImouseK< glutMotion=uncImouseMotionK<
glut&isibility=uncIvisibleK< glut%reateMenuImenuK< glutAddMenu$ntryIWeset timeW( *K< glutAddMenu$ntryIW#lend onW( +K< glutAddMenu$ntryIW#lend oW( )K< glutAddMenu$ntryIWPoint smooth onW( 7K< glutAddMenu$ntryIWPoint smooth oW( 8K< glutAddMenu$ntryIWPoint siJe )W( ,K< glutAddMenu$ntryIWPoint siJe 8W( "K< glutAddMenu$ntryIWPoint siJe GW( FK< glutAddMenu$ntryIWToggle spinW( GK< glutAddMenu$ntryIW)** points W( 9K< glutAddMenu$ntryIW,** points W( +*K<
glutAddMenu$ntryIW+*** points W( ++K
-
8/17/2019 Point Burst
24/30
CHA.'ER "
SNA.SHO'S & RESUL' *ISCUSSION
;ig51 Snap shot of Point (urst initiall, is sho/n 't contains a cluster of Points -ursting outfrom the surface
-
8/17/2019 Point Burst
25/30
;ig 52 Snap shot of Point (urst after it gets eplo+e+ & -ounces freel,
;ig 5A Snap shot of Point (urst /hen the Points reach Dea+ state
-ecomes inisi-le
-
8/17/2019 Point Burst
26/30
;ig 5F Snap shot of Point (urst /hen the Smooth ff
is selecte+ from menu
CONCLUSION & FU'URE ENHANCEEN'S
Conclu0ion
$he %.OIN' BURS'* is +eelope+ to proi+e a G)' $he project is +esigne+ an+
+eelope+ using penG graphic pac3age /ith the ai+ of JC $he project ma3es use of
feature aaila-le in penG /hich facilitates clarit,0 etensi-ilit, an+ ease of maintenance
$his project is +eelope+ to proi+e information to users a-out the effects of particles
A,9antage8
• Eas, to un+erstan+
• Eas, to implement
• ;ast processing
*i0a,9antage8
-
8/17/2019 Point Burst
27/30
• $he surface can -e ma+e to spin manuall, or -, proi+ing option onl, in hori9ontal
/a,
• $he spee+ of surface spinning increasing linearl,
Future Enhancement0
$his project /hich /e hae +eelope+ is a user frien+l, application -ut there is still some
scope for improement li3e the follo/ing
• $he mo+el can -e +eelope+ in AD ie/
• $he surface pattern an+ spee+ can -e controlle+ using menu
A..EN*I;
Function *ESCRI.'ION
glJerteQ=> $he Q in+icate either t/o characters of the form nt or
nt0 /here n7is the no +imenstions=20A0F> it7 is the
+ata t,pe0 such as integer=i>0float=f>
gl(egin=> 't specifies the geometric t,pe that /e /ant our ertices
to +efine the t,pes can -e G8'#ESSuccessie pairs
of ertices to -e interprete+ as the en+points of
in+ii+ual segments
G8'#E8P Dra/ line segment from the final
erte to the first
G8'#E8S$R'P Successie ertices are to -e
connecte+
-
8/17/2019 Point Burst
28/30
G8PG# ine segments connects the
final erte to the first $he interior is fille+
accor+ing to the state of the releant
attri-utes
glEn+=> $erminates a list of ertices
glColorAf=> Sets the present RG( colors
glClearColor=> Clear the color -uffer
glPointSi9e=> Sets the point si9e attri-ute in piels
gl;lush=> ;orces an, -uffere+ penG comman+s to
eecute
glut'nit=> 'nitiali9es G)$
glutCreate.in+o/=> Creates a /in+o/ on the +ispla, an+ la-el
the /in+o/
glut'nitDispla,:o+e=> ReBuests a +ispla, /ith the properties in mo+e
glJie/port=> Specifies a /i+thQheight ie/port in piels
/hose lo/er7left corner is at =0,> measure+
from the origin of the /in+o/
glut:ainoop=> Cause the program to enter an eent7processing
loop
glutPostRe+ispla,=> ReBuests that the +ispla, call-ac3 -e eecute+
after the current call-ac3 returns
-
8/17/2019 Point Burst
29/30
glutDispla,;unc= > 't registers the +ispla, function ?func@ that is eecute+
/hen the /in+o/ nee+s to -e re+ra/n
glut!e,-oar+;unc= > 't registers the 3e,-oar+ call-ac3 function f $he call
-ac3 function returns the "SC'' co+e of 3e, presse+
an+ the position of the mouse
glut'nit.in+o/Si9e= > 't specifies the initial height an+ /i+th of the /in+o/ in
piels
glEna-le Ena-les an openG feature;eatures that can -e ena-le+
inclu+e
G8DEP$ push the current matri stac3
glut:ouse;unc=> sets the mouse call-ac3 for the current /in+o/
glut:otion;unc=> sets the motion an+ passie motion call-ac3 for Current
/in+o/
glutJisi-ilit,;unc=> sets the isi-ilit, call-ac3 for the current/in+o/
-
8/17/2019 Point Burst
30/30
glutCreate:enu=> creates a ne/ pop7up menu
glut"++:enuEntr,=> 't a++s the menu entr, to the -ottom of the current
menu
REFERENCES
1 E+/ar+ "ngel0 'nteractie Computer Graphics " $op7Do/n "pproach )sing
penG0 Pearson E+ucation "sia0 ;ifth E+ition0 2K
2 Computer Graphics )sing penG – ;S