CG Project Report
CG Project Report
JnanaSangam, Belagavi-590018
A Mini-Project report
ON
“HELICOPTER GAME”
BY
SAYOOJYA 4MT19CS139
1 CSE Department
HELICOPTER GAME
CERTIFICATE
This is to certify that the mini project entitled “HELICOPTER GAME” is a bonafide work carried
out by SANGEETH SIVAN bearing USN 4MT19CS134 and SAYOOJYA bearing USN
4MT19CS139 in partial fulfillment of the requirements for the Computer Graphics and
Visualization Laboratory (18CSL68) as per Visvesvaraya Technology University, Belagavi
during the year 2021-22. It is certified that all corrections or suggestions indicated for internal
assessment have been incorporated in the report and has been verified and validated.
................................... .................................................
Signature of the Guides Signature of the HOD
Mrs.JEEVITHA SAMPATH Mr. RAVI NARAYANAN B
Ms.AISHWARYA M BHAT
1. .............................. ...............................
2. .............................. ...............................
2 CSE Department
HELICOPTER GAME
ACKNOWLEDGMENT
We express our gratitude to our institution and management for providing us with good
infrastructure, laboratory facilities, qualified and inspiring staff, whose guidance was immense help
in completion of project successfully.
We are extremely thankful to our dignified principle Dr. G.L. Easwara Prasad for his support and
encouragement.
We thank Mr.Ravi Narayana B, professor & HOD, Department of Computer Science and
Engineering for encouragement and favour.
We would also like to express our deep gratitude to all lectures and lab staffs for their vital and timely
help that have made our project a success.
We would also like to thank our friends who have contributed in all possible ways in completing this
project successfully.
Naturally we take full responsibility for any lack of clarity, occasional erratum or inexactness that may
occur.
(4MT19CS134) (4MT19CS139)
3 CSE Department
HELICOPTER GAME
i
ABSTRACT
The proposed project is simple Helicopter game, which mainly demonstrates the simple application
of Opengl in gaming applications. The idea behind the game is to navigate the helicopter by avoiding
obstacles and avoiding hitting the roof of the cave or the floor. Initially one needs to press the left
mouse button to make the helicopter move upwards, once released helicopter goes down, the gamer
has to concentrate on left button to skip the obstacles. The goal is to go as far as possible so that the
score can be increased.
ii
4 CSE Department
HELICOPTER GAME
TABLE OF CONTENTS
ABSTARCT i
ACKNOWLEDGMENT ii
LIST OF SNAPSHOTS iii
5 CSE Department
HELICOPTER GAME
LIST OF SNAPSHOT
train
iii
6 CSE Department
HELICOPTER GAME
CHAPTER 1
INTRODUCTION
1.1 Computer Graphics
The term computer graphics has been used in a broad sense to describe "almost everything on
computers that is not text or sound". Typically, the term computer graphics refers to several
different things:
Many tools have been developed to visualize data. Computer generated imagery can be
categorized into several different types: two dimensional (2D), three dimensional (3D), and
animated graphics. As technology has improved, 3D computer graphics have become more
common, but 2D computer graphics are still widely used. Computer graphics has emerged as a
sub-field of computer science which studies methods for digitally synthesizing and
manipulating visual content. Over the past decade, other specialized fields have been developed
like information visualization, and scientific visualization more concerned with "the
visualization of three dimensional phenomena (architectural, meteorological, medical,
biological, etc.), where the emphasis is on realistic renderings of volumes, surfaces,
illumination sources, and so forth, perhaps with a dynamic (time) component"[4].
7 CSE Department
HELICOPTER GAME
1.2 OpenGL
OpenGL (Open Graphics Library) is a cross-platform, hardware-accelerated, language
independent, industrial standard API for producing 3D (including 2D) graphics. The OpenGL
specification describes an abstract API for drawing 2D and 3D graphics. OpenGL is the
standard application program interface (API) for defining 2-D and 3-D graphic images. Prior to
OpenGL, any company developing a graphical application typically had to rewrite the graphics
part of it for each operating system platform and had to be cognizant of the graphics hardware
as well. With OpenGL, an application can create the same effects in any operating system using
Although the function definitions are superficially similar to those of the programming
language C, they are language-independent. In addition to being language-independent,
OpenGL is also cross-platform. The specification says nothing on the subject of obtaining, and
managing an OpenGL context, leaving this as a detail of the underlying windowing system. For
the same reason, OpenGL is purely concerned with rendering, providing no APIs related to
input, audio, or windowing. In addition to the features required by the core API, graphics
processing unit (GPU) vendors may provide additional functionality in the form of extensions.
Extensions may introduce new functions and new constants, and may relax or remove
restrictions on existing OpenGL functions. All extensions are collected in, and defined by, the
OpenGL Registry [1].
8 CSE Department
HELICOPTER GAME
CHAPTER 2
REQUIREMENT ANALYSIS
2.1 Non-Functional Requirements
In systems engineering and requirements engineering, a non-functional
requirement (NFR) is a requirement that specifies criteria that can be used to
judge the operation of a system, rather than specific behaviours. They are
contrasted with functional requirements that define specific behaviour or
•
Performance-for example :response time, throughput, utilization, static
volumetric.
•
Scalability
•
Capacity
•
Availability
•
Reliability
•
Recoverability
•
Maintainability
•
Serviceability
9 CSE Department
HELICOPTER GAME
1. Hardware Requirements
2. Software Requirements
10 CSE Department
HELICOPTER GAME
CHAPTER 3
DESIGN
3.1 Description
Train arrival and departure is a newly designed computer graphics mini project.In this
mini project,there will be objects like train,signal, and a place called “railway station.In our
mini project,the second scene describes about the arrival of the train.Here when you press up
arrow key it increases the speed of the train and when you press down arrow key, it decreases
the speed of the train and finally it stops.In the third scene we have shown the departure of the
train.Here the train is in the railway station and starts to depart from the station.When you press
right arrow key it increases the speed of the train and when you press the down arrow key it
decreases the speed of the train.We should press r or R to move from first scene to second
scene and press a or A to move from second scene to third scene.
3.2 Algorithm
An algorithm is a step-by-step instruction to execute the program. The algorithm of our project is
shown below.
11 CSE Department
HELICOPTER GAME
12 CSE Department
HELICOPTER GAME
3. Flowchart
start
Content page
Press ENTER
(down arrow
Scene 1(railway Key)
station)
Decreases the
Press r speed of the
train
Press a key)
Scene 3(Departure if
of train) Increases the
speed of the
(right arrrow
key)
Decreases the
speed of the
train
Stop
(left arrow key)
13 CSE Department
HELICOPTER GAME
Chapter 4
IMPLEMENTATION
4.1 Overview
Implementation is the carrying out, execution, or practice of a plan, a method, or any design for
doing something. As such, implementation is the action that must follow any preliminary
thinking in order for something to actually happen. In an information technology context,
implementation encompasses all the processes involved in getting new software or hardware
operating properly in its environment, including installation, configuration, running, testing,
and making necessary changes. The word deployment is sometimes used to mean the same
thing. This project has been developed using OpenGL provided by Visual C++.
Code Snippet-1
The following code is used to present the first slide and the simulation of the helicopter
Code Snippet-2 :
14 CSE Department
glColor3f(1.0,0.0,0.0);
renderBitmapString(40,70,0,GLUT_BITMAP_HELVETICA_18,"GAME OVER!!!");
glColor3f(1.0,1.0,1.0);
HELICOPTER GAME
renderBitmapString(25,58,0,GLUT_BITMAP_TIMES_ROMAN_24,"You");
renderBitmapString(45,58,0,GLUT_BITMAP_TIMES_ROMAN_24,"scored:");
renderBitmapString(70,58,0,GLUT_BITMAP_TIMES_ROMAN_24,scs);
glutSwapBuffers();
glFlush();
printf("\nGAME OVER\n\n");
printf("%s You scored %s" ,name,scs);
printf("\n\nClose the console window to exit...\n");
Sleep(80);
exit(0);
}else if(wflag==1)//Welcome Screen
{
wflag=0;
glBegin(GL_POLYGON);
glColor3f(1.0,1.0,1.0);
glVertex2f(0.0,100.0);
glColor3f(0.8,0.0,0.4);
glVertex2f(0.0,90.0);
glColor3f(1.0,1.0,0.4);
glVertex2f(100.0,100.0);
glColor3f(0.5,0.1,1.0);
glVertex2f(100.0,90.0);
glEnd();
glBegin(GL_POLYGON);
glColor3f(1.0,1.0,1.0);
glVertex2f(0.0,0.0);
glColor3f(0.8,0.0,0.4);
glVertex2f(100.0,0.0);
glColor3f(1.0,1.0,0.4);
glVertex2f(100.0,10.0);
glColor3f(0.5,0.1,1.0);
glVertex2f(0.0,10.0);
glEnd();
glColor3f(1.0,1.0,1.0);
renderBitmapString(16,85,0,GLUT_BITMAP_HELVETICA_18,"MANGALORE INSTITUTE OF TECHNOLOGY &
ENGINEERING");
glColor3f(0.8,0.0,0.3);
renderBitmapString(39,75,0,GLUT_BITMAP_HELVETICA_18,"DEPARTMENT OF CSE");
glColor3f(0.7,0.5,1.0);
renderBitmapString(20,65,0,GLUT_BITMAP_8_BY_13,"Mini Project in Computer Graphics & Visualization Laboratory");
glColor3f(1.0,1.0,1.0);
renderBitmapString(40.5,70,0,GLUT_BITMAP_TIMES_ROMAN_24,"Helicopter Game");
renderBitmapString(35.5,60,0,GLUT_BITMAP_TIMES_ROMAN_24,"By Sangeeth Sivan & Sayoojya");
glColor3f(0.6,0.0,0.1);
renderBitmapString(40,45,0,GLUT_BITMAP_TIMES_ROMAN_24,"Welcome");
renderBitmapString(53,45,0,GLUT_BITMAP_TIMES_ROMAN_24,name);
renderBitmapString(43,30,0,GLUT_BITMAP_TIMES_ROMAN_24,"Click To Start");
glColor3f(0.6,0.5,1.0);
renderBitmapString(17,24,0,GLUT_BITMAP_9_BY_15,"CLICK AND HOLD LEFT MOUSE BUTTON TO GO UP RELEASE TO
GO DOWN");
glColor3f(0.0,0.0,0.0);
drawcopter();
glutSwapBuffers();
glFlush();
}else
{
if(sci%50==0&&lflag==1)
{
lflag=0; //make level_flag=0
level++;//increase level by 1
bspd+=0.001;//increase block_dx_speed by 0.01
}
else if(sci%50!=0&&lflag!=1)
{
lflag=1;
}
glPushMatrix();
glColor3f(1,1,0.1);
glRectf(0.0,0.0,100.0,10.0); //ceil
glColor3f(1,0.7,1);
glRectf(0.0,100.0,100.0,90.0); //floor
glColor3f(0.0,0.0,0.0); //score
renderBitmapString(1,3,0,GLUT_BITMAP_TIMES_ROMAN_24,"Distance:");
sprintf(slevel,"%d",level); //level
renderBitmapString(80,3,0,GLUT_BITMAP_TIMES_ROMAN_24,"Level:");
renderBitmapString(93,3,0,GLUT_BITMAP_TIMES_ROMAN_24,slevel);
scf+=0.025; //so less as program run very fast
sci=(int)scf;
sprintf(scs,"%d",sci);
renderBitmapString(20,3,0,GLUT_BITMAP_TIMES_ROMAN_24,scs);
glTranslatef(0.0,hm,0.0);
drawcopter();
if(b1x<-10)
{ 15 CSE Department
b1x=50; //total width is 50
b1y=(rand()%25)+20;
HELICOPTER GAME
void glColor3f(GLfloat red, GLfloat green, GLfloat blue): This function sets present RGB
colours. Different colour is given to object using the colours parameters such as red, green,
blue. The maximum and minimum values of the floating point types are 1.0 and 0.0
respectively.
16 CSE Department
HELICOPTER GAME
voidglutInitWindowPosition(int x, int y): This function specifies the initial position of the
17 CSE Department
HELICOPTER GAME
Chapter 5
RESULTS AND SNAPSHOTS
18 CSE Department
HELICOPTER GAME
5.1 Snapshot-1
Referring to the figure 5.1 it shows the initial view of our project.
19 CSE Department
HELICOPTER GAME
5.2 Snapshot-2
Referring to the figure 5.2 it refers to the first scene which shows railway station
5.3 Snapshot-3
Referring to the figure 5.3 it refers to the second scene which shows arrival of the train to the
railway station
20 CSE Department
HELICOPTER GAME
Chapter 6
CONCLUSION AND FUTURE ENHANCEMENT
6.1 Conclusion
This project demonstraest the working of arrival and departure of the train using computer
graphics and different functions of OpenGL. This project mainly tries to give an idea of how the
railway station look like so that we can use his graphics in some animated stories or use to
demonstrate to the small children. The overall implementation of the code is done in Dev-C++
and the programming language used is OpenGL which is mainly used to design the computer
graphics project.
21 CSE Department
HELICOPTER GAME
REFERENCES
M.Pauline Baker
Warren Carithers
22 CSE Department