Anda di halaman 1dari 33

SHOOTING OF SNOW MAN

Chapter – 1:

Introduction

1.1 Project Statement:

1) This game is an openGL application which is executed using visual C++.

2) A snowman like doll will keep moving and the user has to target the doll.

3) If the user misses the target ten times the game is over.

4) At each level user has to get ten points to pass on to next level.

5) As the level increases the speed of the doll increases.

6) Scores are allocated on the basis of the number of times the user hits the target. One
point each for hitting the target once.

7) User can also take a break in between the game by right clicking the mouse button.

8) Left click button on the mouse is used to hit the target.

9) Scores and the level number will be displayed on the executable window to help the
user.

1.2 Input:
Input to this game is keyboard and mouse.
Keyboard for movement and zooming of render scene and provide the pause
and resume option.
Mouse for shoot the snowman

1.3 Output:
Output is nothing but game’s aim that is to show Scores and the level number
will be displayed on the executable window to help the user.

1
Dept. of CS&E
VVIET, MYSORE
SHOOTING OF SNOW MAN

1.4 Goal:
demonstrates the shooting of snowman, which includes features like display
snowman, and shoot that snowman. Which includes different levels in each levels
speed increases and show Scores and the level number will be displayed on
the executable window to help the user.

2
Dept. of CS&E
VVIET, MYSORE
SHOOTING OF SNOW MAN

Chapter – 2:

Literature Survey

2.1 Proposed System:


demonstrates the shooting of snowman, which includes features like display
snowman, and shoot that snowman. Which includes different levels in each levels
speed increases and show Scores and the level number will be displayed on the
executable window to help the user. User can also take a break in between the game
by right clicking the mouse button. If we shoot the snowman it damages the particular
area.

2.2 Existing System:


demonstrates the shooting of snowman, which includes features like display
snowman, and shoot that snowman. Which includes three levels in each levels speed
increases and show Scores and the level number will be displayed on the executable
window to help the user. User can also take a break in between the game by right
clicking the mouse button.

2.3 Technical Feasibility:


Technical feasibility is the study of the resource availability that may affect
the ability to achieve an acceptable system. It is essential that the process of the
analysis and definition be conducted in parallel with an assessment with technical
feasibility. This project does not have technical difficulty in installing, does not have
complex errors in installing. The errors are is easy to debug.

2.4 Economic feasibility:


An evolution of development cost weighed against the ultimate income or
benefit derived from the developed system. Economical justification includes broad
range of concerns that include man hours that are required to record data about
activity and also in terms of money benefits by the selling of this system as a product.
Thus this project work is economically feasible for the development in any company.
3
Dept. of CS&E
VVIET, MYSORE
SHOOTING OF SNOW MAN

Chapter – 3:

Analysis

3.1 Hardware Requirements:


This game requires a hardware requirement of a processor of speed 333 MHz,
32MB or above RAM capacity, a graphic card, a Keyboard and a min.100kb of hard
disk space.

Requirements in detail
• Computer : IBM Compatible
• Micro Processor : Pentium 1 Onwards/amd
• CPU Clock : 166MHZ Onwards
• RAM : 32 MB or Higher
• Hard Disk Driver : 2 GB or Higher
• VGA Adapter : Intel 82810 graphics
controller(minimum)
• Monitor : Standard VGA Monitor
• Keyboard : 102 Keys Keyboard
• 3-Button mouse : yes

3.2 Software Requirements:


This game can be run on any system which supports MS-DOS.
• Operating System: Win 98/Win xp.
• Microsoft Visual Studio 2005: This software package containing visual
basics in c++ language is required.
• OPENGL API is used with GLUT.

4
Dept. of CS&E
VVIET, MYSORE
SHOOTING OF SNOW MAN

3.3 Technology Used:


Visual Basic is a high level programming language evolved from the earlier
DOS version called BASIC. It is fairly easy programming language to learn. Visual
Basic is a Visual & events driven programming language. Here programming is done
in a graphical environment. Microsoft Visual Studio 2005 supports vb language in
that C/C++ Programming language is used for development of this project.

OPENGL is a Software Interface to Graphics Hardware. This interface


Consists of about 150 Distinct Commands which is used to specify the objects and
operations needed to produce interactive three dimensional applications. It is a
Hardware-independent Interface. It has no command for windows or user input
handling. It does not include low-level I/O management. It is a Mid-level, device-
independent, portable graphics subroutine package.

OPENGL uses a header file called GLUT.H which involves all primitive
functions, which helps in development of graphical packages, also no overhead in
implementing the manual graphical functions. GLUT is used to interface the window
system and to get input from external devices into our programs.

5
Dept. of CS&E
VVIET, MYSORE
SHOOTING OF SNOW MAN

Chapter – 4:

Design

4.1 System Design:


Main function

STAR
T

Set window
system parameter

initScene(); A

glutDisplayFunc
(drawScene) B

glutMouseFunc
C
(inputMouse)

glutTimer
Func(10,timer,10 D
0)

STOP

6
Dept. of CS&E
VVIET, MYSORE
SHOOTING OF SNOW MAN

initScene() Function drawScene() Function

A B

drawScene();
initScene();

drawSnowMan()
;
Set enabling features
using glEnable() R
glTranslatef(x+=speed
flag ,y,z)
L =?

Set viewing functions

glTranslatef(x-
RETURN =speed,y,z);

drawSnowMan()
;

RETURN

7
Dept. of CS&E
VVIET, MYSORE
SHOOTING OF SNOW MAN

inputMouse() Function timer() Function

C D

inputMouse() timer()

drawScene();
If
button==GLUT_LE
FT_BUTTON&&stat
e==GLUT_DOWN

F
xp>=(posX-
0.75)&&(xp<=pos
X+0.75)&&posY> miss=miss-1
=0&&posY<=2.6

hit=hit+1

return()

8
Dept. of CS&E
VVIET, MYSORE
SHOOTING OF SNOW MAN

4.2 Detailed Design:


User-defined Functions

void inputMouse( int button, int state, int x, int y ) ;

This module:

• The press of the right mouse button pauses the game.


• If the user clicks on the target using left button,score will be incremented
• int main(int argc, char** argv)
• This module :

• Initialises GLUT.Arguments from main are passed in and can be used by


o the application
• Requests a display with properties in mode.
• Specifies the initial height and width of the window in pixel.
• Specifies the initial position of the top-left corner of the window in pixel.
• Creates a window for display.
• Callsback the following functions:

initsScene()

drawScene()

changeSize()

inputMouse()

void drawScene(void)

This module:
9
Dept. of CS&E
VVIET, MYSORE
SHOOTING OF SNOW MAN

• Calls back the module drawSnowMan().


• Draws the background and foreground scenes.
• Displays the score and level number.

void drawSnowMan(void)

This module:

• Draws the body of the doll.

void initScene()

This module:

• Enables the openGL features such as.

GL_DEPTH_TEST

GL_LIGHTING

GL_LIGHT0

GL_COLOR_MATERIAL

• Sets viewing functions.

10
Dept. of CS&E
VVIET, MYSORE
SHOOTING OF SNOW MAN

Chapter – 5:

Implementation

5.1 About Computer Graphics:


CG (Computer graphics) started with the display of data on hardcopy plotters
and cathode ray tube screens soon after the introduction of computer themselves. It
includes the creation, storage, and manipulation of models and images of objects.
These models include physical, mathematical, engineering, architectural, and even
conceptual or abstract structures, natural phenomena, and so on. Computer Graphics
today is largely interactive- the user controls the contents, structure, and appearance
of objects and their displayed images by using input devices, such as keyboard, mouse
or touch sensitive panel on the screen. Bitmap graphics is used for user-computer
interaction.
11
Dept. of CS&E
VVIET, MYSORE
SHOOTING OF SNOW MAN

A Bitmap is a ones and zeros representation of points (pixels, short for ‘picture
elements’) on the screen. Bitmap graphics provide easy-to-use and inexpensive
graphics based applications

This allowed users to switch among multiple activities just by pointing at the
desired window, typically with the mouse. Graphics provides one of the most natural
means of communicating with the computer, since our highly developed 2D and 3D
pattern – recognition abilities allow us to perceive and process pictorial data rapidly
and efficiently. In many design, implementation, and construction processes, the
information pictures can give is virtually indispensable.

Interactive Computer Graphics is the most important means of producing


pictures since the invention of photography and television, By making communication
more efficient, graphics makes possible higher-quality And more precise results or
products, greater productivity, and lower analysis and design costs.

5.2 About OPENGL:


It is a Software Interface to Graphics Hardware. This interface Consists of
about 150 Distinct Commands which is used to specify the objects and operations
needed to produce interactive three dimensional applications. It is a Hardware-
independent Interface. It has no command for windows or user input handling. It does
not include low-level I/O management. It is a Mid-level, device-independent, portable
graphics subroutine package.

Characteristics of OPENGL are:


• Developed primarily by SGI
• 2D/3D graphics, lower-level primitives (polygons)
• Basis for higher-level libraries/toolkits
• Main purpose is to render two and three dimensional objects into a frame
buffer. These objects are described as sequences of vertices (which define
geometric objects) or pixels (which define images).
12
Dept. of CS&E
VVIET, MYSORE
SHOOTING OF SNOW MAN

• Performs several processing steps on this data to convert it to pixels to form


the final desired image in the frame buffer.
• Network-transparent.
• Nothing more than a set of functions you call from your program (think of as
collection of .h file(s)).
• Hides the details of the display adapter, operating system, etc.
• Comprises several libraries with varying levels of abstraction: GL, GLU, and
GLUT
• Several levels of abstraction are provided
• Easy to use
• Close enough to the hardware to get excellent performance
• Focus on rendering
• Omitted windowing and input to avoid window system dependencies

5.3 Source Code:

#include<windows.h>
#include <GL/glut.h>
#include <math.h>
#include <stdio.h>

//lighting
GLfloat LightAmbient[]={0.2f,0.2f,0.2f,0.0f};
GLfloat LightDiffuse[]={0.8f,0.8f,0.8f,0.0f};
GLfloat LightPosition[]={1.0f,-0.5f,-0.5f,0.0f};

float angle=0.0;
float x=0.0f,y=2.0f,z=0.0f;
float lx=0.0f,ly=0.0f,lz=-1.0f;
13
Dept. of CS&E
VVIET, MYSORE
SHOOTING OF SNOW MAN

float ratio;
char s[30];
float xp=-12,yp=0,zp=-25;
int mis=0,hit=0,hits;
int score[2];
float speed=0.08;
int i=1;
int state;
int game_over=0;
int ntpause=0;
int flag=0;
GLuint DLid;

GLuint createDL(void);

void changeSize(int w, int h) {

// Prevent a divide by zero, when window is too short


// (you cant make a window of zero width).
if(h == 0)
h = 1;

ratio = 1.0f * w / h;
// Reset the coordinate system before modifying
glMatrixMode(GL_PROJECTION);
glLoadIdentity();

// Set the viewport to be the entire window


glViewport(0, 0, w, h);

// Set the clipping volume


gluPerspective(45,ratio,1,1000);
glMatrixMode(GL_MODELVIEW);

14
Dept. of CS&E
VVIET, MYSORE
SHOOTING OF SNOW MAN

glLoadIdentity();
gluLookAt(x, y, z,
x + lx,y + ly,z + lz,
0.0f,1.0f,0.0f);
}

void initScene()
{
glEnable(GL_DEPTH_TEST);

////g_blighting=true;
//glLightfv(GL_LIGHT0,GL_AMBIENT,LightAmbient);
//glLightfv(GL_LIGHT0,GL_DIFFUSE,LightDiffuse);
//glLightfv(GL_LIGHT0,GL_POSITION,LightPosition);
//
//glLightfv(GL_LIGHT0,GL_POSITION,LightPosition);
////two the side
//glLightModeli(GL_LIGHT_MODEL_TWO_SIDE,GL_TRUE);
//glEnable (GL_LIGHTING);
// glEnable (GL_LIGHT0);
//
}
void drawSnowMan()
{
//glColor3f(0.7f, .8f, .0f);
glColor3f(.5f, .5f, .5f);

// Draw Body
glTranslatef(0.0f ,0.75f, 0.0f);
glutSolidSphere(0.75f,20,20);

// Draw Head

15
Dept. of CS&E
VVIET, MYSORE
SHOOTING OF SNOW MAN

glTranslatef(0.0f, 1.0f, 0.0f);


glutSolidSphere(0.25f,20,20);

// Draw Eyes
glPushMatrix();
glColor3f(0.0f,0.0f,0.0f);
glTranslatef(0.05f, 0.10f, 0.18f);
glutSolidSphere(0.05f,10,10);
glTranslatef(-0.1f, 0.0f, 0.0f);
glutSolidSphere(0.05f,10,10);
glPopMatrix();

// Draw Nose
glColor3f(1.0f, 0.f , 0.f);
glRotatef(0.0f,1.0f, 0.0f, 0.0f);
glutSolidCone(0.08f,0.5f,10,2);
}

GLuint createDL()
{
GLuint snowManDL,loopDL;

snowManDL = glGenLists(1);
loopDL = glGenLists(1);

glNewList(snowManDL,GL_COMPILE);
drawSnowMan();
glEndList();
glNewList(loopDL,GL_COMPILE);

glPushMatrix();
if(xp>=12)

16
Dept. of CS&E
VVIET, MYSORE
SHOOTING OF SNOW MAN

flag=1;
if(xp<=-12)
flag=0;
if(flag==0)
glTranslatef(xp+=speed,yp,zp); //from left to right.
if(flag==1)
glTranslatef(xp-=speed,yp,zp); //from right to left.
if(flag==-1)
glTranslatef(xp,yp,zp); //pause the game.
glCallList(snowManDL);
glPopMatrix();

glEndList();

return(loopDL);
}
void renderScene(void)
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

glPushMatrix();
glColor3f(1.0f, 0.0f, 0.0f);
glTranslatef(9.0,1.0,-16.0);
glutSolidCube(1);
drawSnowMan(); //draw RIGHT stil doll
glPopMatrix();

glPushMatrix();
glColor3f(1.0f, 0.0f, 0.0f);
glTranslatef(-9.0,1.0,-16.0);
glutSolidCube(1);
drawSnowMan(); //draw LEFT stil doll
glPopMatrix();

17
Dept. of CS&E
VVIET, MYSORE
SHOOTING OF SNOW MAN

// Draw ground
glColor3f(0.9f, 0.9f, 0.9f);
glBegin(GL_QUADS);
glVertex3f(-13.0f, 0.0f, -27.0f);
glVertex3f(-13.0f, 0.0f, 10.0f);
glVertex3f( 13.0f, 0.0f, 10.0f);
glVertex3f( 13.0f, 0.0f, -27.0f);
glEnd();
glColor3f(0.0f, 0.0f, 1.0f);
glColor3f(0.0f, 0.0f, 0.4f);
DLid = createDL();
glCallList(DLid);
glColor3f(1.0,0.0,0.0);
glRasterPos3i(-10,8,-20);
glutBitmapCharacter(GLUT_BITMAP_HELVETICA_18,'S'); //To Display
the score..
glutBitmapCharacter(GLUT_BITMAP_HELVETICA_18,'C');
glutBitmapCharacter(GLUT_BITMAP_HELVETICA_18,'O');
glutBitmapCharacter(GLUT_BITMAP_HELVETICA_18,'R');
glutBitmapCharacter(GLUT_BITMAP_HELVETICA_18,'E');
glutBitmapCharacter(GLUT_BITMAP_HELVETICA_18,' ');
glutBitmapCharacter(GLUT_BITMAP_HELVETICA_18,':');
glutBitmapCharacter(GLUT_BITMAP_HELVETICA_18,' ');
glutBitmapCharacter(GLUT_BITMAP_HELVETICA_18,score[1]+48);
glutBitmapCharacter(GLUT_BITMAP_HELVETICA_18,score[0]+48);
glRasterPos3i(-4,8,-20);
glutBitmapCharacter(GLUT_BITMAP_HELVETICA_18,'L'); //To Display the
level.
glutBitmapCharacter(GLUT_BITMAP_HELVETICA_18,'E');
glutBitmapCharacter(GLUT_BITMAP_HELVETICA_18,'V');
glutBitmapCharacter(GLUT_BITMAP_HELVETICA_18,'E');
glutBitmapCharacter(GLUT_BITMAP_HELVETICA_18,'L');
glutBitmapCharacter(GLUT_BITMAP_HELVETICA_18,' ');

18
Dept. of CS&E
VVIET, MYSORE
SHOOTING OF SNOW MAN

glutBitmapCharacter(GLUT_BITMAP_HELVETICA_18,':');
glutBitmapCharacter(GLUT_BITMAP_HELVETICA_18,' ');
glutBitmapCharacter(GLUT_BITMAP_HELVETICA_18,(i-1)+48);
glRasterPos3i(2,8,-20);
glutBitmapCharacter(GLUT_BITMAP_HELVETICA_18,'M'); //To
Display the missed..
glutBitmapCharacter(GLUT_BITMAP_HELVETICA_18,'I');
glutBitmapCharacter(GLUT_BITMAP_HELVETICA_18,'S');
glutBitmapCharacter(GLUT_BITMAP_HELVETICA_18,'S');
glutBitmapCharacter(GLUT_BITMAP_HELVETICA_18,'E');
glutBitmapCharacter(GLUT_BITMAP_HELVETICA_18,'D');
glutBitmapCharacter(GLUT_BITMAP_HELVETICA_18,':');
glutBitmapCharacter(GLUT_BITMAP_HELVETICA_18,' ');
if (mis==10)
{
glutBitmapCharacter(GLUT_BITMAP_HELVETICA_18,1+48);
glutBitmapCharacter(GLUT_BITMAP_HELVETICA_18,0+48);}
else
glutBitmapCharacter(GLUT_BITMAP_HELVETICA_18,mis+48);
if(flag==-1 &&ntpause==0)
{
glRasterPos3i(7,8,-20);
glutBitmapCharacter(GLUT_BITMAP_HELVETICA_18,'P');
glutBitmapCharacter(GLUT_BITMAP_HELVETICA_18,'A');
glutBitmapCharacter(GLUT_BITMAP_HELVETICA_18,'U');
glutBitmapCharacter(GLUT_BITMAP_HELVETICA_18,'S');
glutBitmapCharacter(GLUT_BITMAP_HELVETICA_18,'E');
glutBitmapCharacter(GLUT_BITMAP_HELVETICA_18,'D');
}

if(game_over==1)
{
glRasterPos3i(7,8,-20);

19
Dept. of CS&E
VVIET, MYSORE
SHOOTING OF SNOW MAN

glutBitmapCharacter(GLUT_BITMAP_TIMES_ROMAN_24,'G');
glutBitmapCharacter(GLUT_BITMAP_TIMES_ROMAN_24,'A');
glutBitmapCharacter(GLUT_BITMAP_TIMES_ROMAN_24,'M');
glutBitmapCharacter(GLUT_BITMAP_TIMES_ROMAN_24,'E');
glutBitmapCharacter(GLUT_BITMAP_TIMES_ROMAN_24,' ');
glutBitmapCharacter(GLUT_BITMAP_TIMES_ROMAN_24,'O');
glutBitmapCharacter(GLUT_BITMAP_TIMES_ROMAN_24,'V');
glutBitmapCharacter(GLUT_BITMAP_TIMES_ROMAN_24,'E');
glutBitmapCharacter(GLUT_BITMAP_TIMES_ROMAN_24,'R');
glutBitmapCharacter(GLUT_BITMAP_TIMES_ROMAN_24,'!');
}
glutSwapBuffers();
}
void orientMe(float ang)
{
lx = sin(ang);
lz = -cos(ang);
glLoadIdentity();
gluLookAt(x, y, z,
x + lx,y + ly,z + lz,
0.0f,1.0f,0.0f);
}
void times(int p)
{
renderScene();
//glutPostRedisplay();
glutTimerFunc(10,times,p);
}
void moveMeFlat(int i) {
x = x + i*(lx)*0.1;
z = z + i*(lz)*0.1;
glLoadIdentity();
gluLookAt(x, y, z,

20
Dept. of CS&E
VVIET, MYSORE
SHOOTING OF SNOW MAN

x + lx,y + ly,z + lz,


0.0f,1.0f,0.0f);
}

void inputMouse(int button,int state,int x,int y)


{
if(button==GLUT_LEFT_BUTTON && state==GLUT_DOWN) //if the user
clicks the left mouse button
{
//printf("%d,%d\t\t",x,y);
//printf("%f,%f\n",xp,yp);
GLint viewport[4];
GLdouble modelview[16];
GLdouble projection[16];
GLfloat winX, winY, winZ;
GLdouble posX, posY, posZ;
glGetDoublev( GL_MODELVIEW_MATRIX, modelview );
glGetDoublev( GL_PROJECTION_MATRIX, projection );
glGetIntegerv( GL_VIEWPORT, viewport );
winX = (float)x;
winY = (float)viewport[3] - (float)y;
glReadPixels( x, int(winY), 1, 1, GL_DEPTH_COMPONENT,
GL_FLOAT, &winZ );

gluUnProject( winX, winY, winZ, modelview, projection, viewport,


&posX, &posY, &posZ);
//printf("%f,%f\n",posX,posY,posZ);
if(flag!=-1 && game_over!=1) //MAKE SURE THAT
GAME IS NOT PAUSED
{
if(xp>=(posX-0.75)&&(xp<=posX+0.75)&&posY>=0&&posY<=2)
//Check if the user clicks on the doll
{

21
Dept. of CS&E
VVIET, MYSORE
SHOOTING OF SNOW MAN

hit++;
printf("Your Score is %d\n\n",hit);

hits=hit;
if(hit==10*i)
{

speed+=0.03;
i++;
}

int j=0;
while(hits>0)
{
score[j]=hits%10;
hits/=10;
//printf("%d\n",score[j]);
j++;
}
}
else
{
mis++;
if(mis==10)
{
game_over=1;
flag=-1;
ntpause=1;
}
printf("Sorry..U missed it..\n\n");
}
}

22
Dept. of CS&E
VVIET, MYSORE
SHOOTING OF SNOW MAN

}
}
void inputKey(unsigned char c, int x, int y) {

switch (c) {
case 'a' : angle -= 0.05f;orientMe(angle);break;
case 'd' : angle +=0.05f;orientMe(angle);break;
case 'w' : moveMeFlat(5);break;
case 's' : moveMeFlat(-5);break;
case 'p' : if(flag==0)
{
state=0; //paused when doll is moving right.
flag=-1;
}
else if(flag==1)
{
state=1;
flag=-1; //paused when doll is moving
right.
}
else if(flag==-1 && state==0) //resume right.
flag=0;
else if(flag==-1 && state==1) //resume left.
flag=1;
break;
}
}

int main(int argc, char **argv)


{
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_DEPTH | GLUT_DOUBLE | GLUT_RGBA);
glutInitWindowPosition(25,0);

23
Dept. of CS&E
VVIET, MYSORE
SHOOTING OF SNOW MAN

glutInitWindowSize(640,400);
glutCreateWindow("Shooting game by Suhas and Sagar");
initScene();
glutKeyboardFunc(inputKey);
glutMouseFunc(inputMouse);
glutDisplayFunc(renderScene);
//glutIdleFunc(renderScene);
glutTimerFunc(10,times,100);
glutReshapeFunc(changeSize);
glutMainLoop();
return(0);
}

Chapter – 6:

Verification & Validation

24
Dept. of CS&E
VVIET, MYSORE
SHOOTING OF SNOW MAN

6.1 Overview:
The objective of this chapter is to introduce techniques that may be used to test
programs to discover program faults In other words we can say that this chapter is
mainly based on:
• Understand a number of testing techniques that are used to discover program
faults.
• Has been introduced to guidelines that support the testing of component
interfaces;
• Understand specific approaches to component testing and integration testing
for object oriented systems;
• Understand the principles of operation of CASE tool support for testing,

The overall objective of event based testing is to find the maximum


number of errors with a minimum effort. In event based testing the view of
testing broadens to include the review of both analysis model.

6.2 Testing Process:

6.2.1 Unit Testing:


Individual components are tested to ensure that they operate correctly.
Each component is tested independently, without other system component. Each piece
is drawn separately to test, display function is tested separately, iconoutline functions
are tested separately, mark function is tested separately, output function is tested
separately, passive outline function is tested separately, myinit function is tested
separately. circle drawing functions are tested separately, menu function is tested
separately.

6.2.2 Integration Testing:


A module is a collection of dependent components such as some
looser collection of procedure and user defined functions. In this project we have used
several user defined functions which are formed by the integration some procedures
and other user defined functions.

25
Dept. of CS&E
VVIET, MYSORE
SHOOTING OF SNOW MAN

Welcome screen function is tested for integration, it contains iconoutline


functions and passive outline function.

Passive outline function is tested for integration, it contains iconoutline


functions.

Keyboard function is tested for integration, it contains display, piece, clear and
mark functions.

Mouse function tested for integration, it contains display, output, menu


functions.

Chapter – 7:

Conclusion and Future Enhancements

26
Dept. of CS&E
VVIET, MYSORE
SHOOTING OF SNOW MAN

Conclusion:
The “SHOOTING GAME” is developed to provide a GUI. The project is
designed and developed using OpenGL graphic package with the aid of VC++. The
project makes use of feature available in OpenGL which facilitates clarity,
extensibility and ease of maintenance.

This project is developed to provide entertainment to users as an shooting


application.

Advantage:
• Easy to understand.
• Easy to implement.
• Fast processing.

Disadvantage:
• If we shoot the snowman it do not show the damaged area.

Future Enhancements:

This project which we have developed is a user friendly application but there is
still some scope for improvement like the following:
• More clear view to the user about whether the user has hit the target or not.
• The game can be made more complicated by making the snowman move in
different directions when we pass on to next level.

Bibliography

1. Edward Angel, Interactive Computer Graphics A Top-Down Approach Using


OpenGL, Pearson Education Asia, Fifth Edition, 2008

27
Dept. of CS&E
VVIET, MYSORE
SHOOTING OF SNOW MAN

2. Computer Graphics Using OpenGL – F.S Hill,Jr. Second Edition, Pearson


Education 2001

3. Computer Graphics- James D Foley, Andries Van Dam, Steven K Feiner, John
F Hughes, Addison-wesley 1997

4. Computer Graphics – OpenGL Version – Donald Hearn and Pauline Baker,


Second Edition, Pearson Education, 2003

28
Dept. of CS&E
VVIET, MYSORE
SHOOTING OF SNOW MAN

Snapshots

This is the snapshot when the user has just moved on to second level with a score of 09.

29
Dept. of CS&E
VVIET, MYSORE
SHOOTING OF SNOW MAN

This is the snapshot taken when game gets over.

Appendix

Function Meaning

glVertex*() The * indicate either two characters of the


form nt or ntv, where n-is the no.
dimenstions(2,3,4); it- is the data type, such as
integer(i),float(f).

glBegin() It specifies the geometric type that we want our


vertices to define. the types can be
GL_LINES:Successive pairs of vertices to be
interpreted as the endpoints of individual
segments.
GL_LINE_LOOP: Draw line segment from the
final vertex to the first.

30
Dept. of CS&E
VVIET, MYSORE
SHOOTING OF SNOW MAN

GL_LINE_STRIP: Successive vertices are to be


connected.
GL_POLYGON: Line segments connects the
final vertex to the first. The interior is filled
according to the state of the relevant attributes.

glEnd() Terminates a list of vertices.

glColor3f() Sets the present RGB colors.

glClearColor() Clear the color buffer.

glPointSize() Sets the point size attribute in pixels.

glFlush() Forces any buffered OpenGL commands to


execute.

glutInit() Initializes GLUT.

glutCreateWindow() Creates a window on the display and label


the window.

glutInitDisplayMode() Requests a display with the properties in mode.

glViewport() Specifies a width*height viewport in pixels


whose lower-left corner is at (x,y) measured
from the origin of the window.

glutMainLoop() Cause the program to enter an event-processing


loop.

31
Dept. of CS&E
VVIET, MYSORE
SHOOTING OF SNOW MAN

glutPostRedisplay() Requests that the display callback be executed


after the current callback returns.

glutBitmapCharacter( ): It renders the charcter with ASCII code char at


the current raster position using the raster font
given by font. Fonts include
GLUT_BITMAP_TIMES_ROMAN_10 and
GLUT_BITMAP_TIMES_ROMAN_8_BY_13.

glRasterPos*( ): It specifies a raster position in 2,3, or 4


dimensions. The coordinates can be specified as
shorts s,ints i,floats f or doubles d.

glutDisplayFunc( ): It registers the display function ‘func’ that is


executed when the window needs to be redrawn.

glutKeyboardFunc( ): It registers the keyboard callback function f. The


call back function returns the ASCII code of key
pressed and the position of the mouse.

glutInitWindowSize( ): It specifies the initial height and width of the


window in pixels.

glEnable: Enables an openGL feature.Features that can be


enabled include
GL_DEPTH_TEST,GL_LIGHTING,
GL_TEXTURE_1D,GL_TEXTURE_2D,
GL_TEXTURE_3D,GL_LINE_SMOOTH,
GL_POLYGON_SMOOTH,
GL_POINT_SMOOTH,GL_BLEND,

32
Dept. of CS&E
VVIET, MYSORE
SHOOTING OF SNOW MAN

GL_LINE_STIPPLE,
GL_POLYGON_STIPPLE, GL_NORMALIZE

glHint: Requests that hint be applied to option.

glutTimerFunc: Execution of this function starts the timer in the


event loop that delays the event
loop for delay
milliseconds.

33
Dept. of CS&E
VVIET, MYSORE

Anda mungkin juga menyukai