Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

Catch Report

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 25

Catch me

Chapter 1
INTRODUCTION
1.1 Computer Graphics
• Graphics provides one of the most natural means of communicating with a computer,
since our highly developed 2D Or 3D pattern-recognition abilities allow us to
perceive and process pictorial data rapidly.
• Computers have become a powerful medium for the rapid and economical production
of pictures.
• Graphics provide a so natural means of communicating with the computer that they
have become widespread.
• Interactive graphics is the most important means of producing pictures since the
invention of photography and television .
• We can make pictures of not only the real world objects but also of abstract objects
such as mathematical surfaces on 4D and of data that have no inherent geometry.
• A computer graphics system is a computer system with all the components of the
general purpose computer system. There are five major elements in system: input
devices, processor, memory, frame buffer, output devices.

Fig:-(a) Computer Graphics System

1|Page
Downloaded from WWW.VTULOOP.COM
Catch me

1.2 OpenGL Technology


OpenGL is the premier environment for developing portable, interactive 2D and 3D graphics
applications. Since its introduction in 1992, OpenGL has become the industry's most widely
used and supported 2D and 3D graphics application programming interface (API), bringing
thousands of applications to a wide variety of computer platforms.

OpenGL fosters innovation and speeds application development by incorporating a broad set
of rendering, texture mapping, special effects, and other powerful visualization functions.
Developers can leverage the power of OpenGL across all popular desktop and workstation
platforms, ensuring wide application deployment.

OpenGL Available Everywhere: Supported on all UNIX® workstations, and shipped


standard with every Windows 95/98/2000/NT and MacOS PC, no other graphics API
operates on a wider range of hardware platforms and software environments.

OpenGL runs on every major operating system including Mac OS, OS/2, UNIX, Windows
95/98, Windows 2000, Windows NT, Linux, Open Step, and BeOS; it also works with every
major windowing system, including Win32, MacOS, Presentation Manager, and X-Window
System. OpenGL is callable from Ada, C, C++, Fortran, Python, Perl and Java and offers
complete independence from network protocols and topologies.

The OpenGL interface


Our application will be designed to access OpenGL directly through functions in three
libraries namely: gl,glu,glut.

Fig:(b) OpenGL Interface

Chapter 2

LITERATURE OVERVIEW

2|Page
Downloaded from WWW.VTULOOP.COM
Catch me

The basic functions like glcolor3f(…..);


glrotatef(…..); gltranslate(…..) etc. that are most commoly Used in the code are taken form the
prescribed VTU text book “INTERACTIVE COMPUTER GRAPHICS” 5th edition by Edward
Angel.[1].

The lab programs in the syllabus also serve as a basic template for creating a project. The usage of
colors and specifications are taken from the various programs that were taught in the lab. [1]. The
VTU prescribed text book serves as a huge database of functions and they are used in the project.

The C concepts which are used, are being taken from the book named Yeshwant Kanitkar.
Some concepts like constructing bowl and fountain are taken from the search results in the
codecolony.com.

Chapter 3
REQUIREMENTS AND SPECIFICATIONS
3.1 Purpose of the requirements document
The software requirement specification is the official statement of what is required for
development of particular project. It includes both user requirements and system
requirements. This requirement document is utilized by variety of users starting from project
manager who gives project to the engineer responsible for development of project.

It should give details of how to maintain, test, verify and what all the actions to be carried out
through life cycle of project.

Scope of the project

3|Page
Downloaded from WWW.VTULOOP.COM
Catch me

The scope is to use the basic primitives defined in openGL library creating complex objects.
We make use of different concepts such as pushmatrix(),translate() ,popmatrix(),timer
function.

Definition

The project CATCH ME IF YOU CAN!!! is created to demonstrate OpenGL’s concepts. It


encompasses some of the skills learnt in our OpenGL classes such as
pushmatrix(),translate() ,popmatrix(),timer function
.

Acronyms & Abbreviations


OpenGL provides a powerful but primitive set of rendering command, and all higher level
design must be done in terms of these commands.

OpenGL Utility Toolkit(GLUT):- windows-system-independent toolkit.

References
OpenGL tutorials

Interactive Computer Graphics(Edward Angel)

3.2 Specific requirements

User Requirement:
• Easy to understand and should be simple.

• The built-in functions should be utilized to maximum extent.

• OpenGL library facilities should be used.

Software Requirements:
• Ubuntu Os.

• Eclipse compiler.

Hardware Requirements:
• Processor- Intel or AMD(Advanced Micro Devices)
4|Page
Downloaded from WWW.VTULOOP.COM
Catch me

• RAM- 512MB(minimum)

• Hard Disk-1MB(minimum)

• Mouse

• Keyboard

• Monitor

Chapter 4
DESIGN
4.1 User Defined Functions

 myinit():
This function initializes light source for ambient, diffuse and specular types.

 display():
This function creates and translates all the objects in a specified location in a particular
order and also rotates the objects in different axes.

glClear(GL_COLOR_BUFFER_BIT);
glFlush();

 timerfunc():
This function starts a timer in the event loop that delays the event loop for delay
miiliseconds.

 MainLoop():
This function whose execution will cause the program to begin an event processing
loop.

 PushMatrix():

5|Page
Downloaded from WWW.VTULOOP.COM
Catch me

Save the present values of attributes and matrices placing ,or pushing on the top of the
stack.

 PopMatrix():
We can recover them by removing them from stack;

 Translated();
In translate func the variables are components of the displacement vector.

 main():
The execution of the program starts from this function. It initializes the graphics
system and includes many callback functions.

 PostRedisplay():
It ensures that the display will be drawn only once each time the program goes
through the event loop.

Chapter 5
IMPLEMENTATION
5.1 FUNCTIONS
GL_LINES -
Treats each pair of vertices as an independent line segment. Vertices
2n - 1 and 2n define line n. N/2 lines are drawn.

GL_LINE_LOOP -
Draws a connected group of line segments from the first vertex to the last, then back to the
first. Vertices n and n + 1 define line n. The last line, however, is defined by vertices N and N
lines are drawn.

Basic Functions
glPushMatrix, glPopMatrix Function
The glPushMatrix and glPopMatrix functions push and pop the current matrix stack.

SYNTAX: void glPushMatrix();


void glPopMatrix(void);

glBegin, glEnd Function

6|Page
Downloaded from WWW.VTULOOP.COM
Catch me

The glBegin and glEnd functions delimit the vertices of a primitive or a group of like
primitives.

SYNTAX:
void glBegin, glEnd(GLenum mode);

PARAMETERS:
 mode -

The primitive or primitives that will be created from vertices presented between glBegin and
the subsequent glEnd. The following are accepted symbolic constants and their meanings:

Transformation Functions
glTranslate Function
The glTranslated and glTranslatef functions multiply the current matrix by a translation
matrix.

SYNTAX:
void glTranslate( x, y, z);

PARAMETERS:
 x, y, z - The x, y, and z coordinates of a translation vector.

Funtions used to display

glMatrixMode Function
The glMatrixMode function specifies which matrix is the current matrix.

SYNTAX:
void glMatrixMode(GLenum mode);

PARAMETERS:
 mode - The matrix stack that is the target for subsequent matrix operations. The mode
parameter can assume one of three values:

Value Meaning

7|Page
Downloaded from WWW.VTULOOP.COM
Catch me

GL_MODELVIEW Applies subsequent matrix operations to the


modelview matrix stack.

glLoadIdentity Function
The glLoadIdentity function replaces the current matrix with the identity matrix.

SYNTAX:

void glLoadIdentity(void);

5.2 FUNCTIONS USED TO SET THE VIEWING VOLUME

glOrtho
This function defines orthographic viewing volume with all parameters measured from the
centre of projection.

multiply the current matrix by a perspective matrix.

SYNTAX:

void glOrtho( GLdouble left, GLdouble right, GLdouble bottom, GLdouble top,
GLdouble near, GLdouble far)

PARAMETERES:

 left, right -
Specify the coordinates for the left and right vertical clipping planes.
 bottom, top -
Specify the coordinates for the bottom and top horizontal clipping planes.
 nearVal, farVal -

Specify the distances to the nearer and farther depth clipping planes. These values are
negative if the plane is to be behind the viewer.

5.3 CALL BACK FUNCTIONS

8|Page
Downloaded from WWW.VTULOOP.COM
Catch me

glutDisplayFunc Function
glutDisplayFunc sets the display callback for the current window.

SYNTAX:
void glutDisplayFunc(void (*func)(void));

glutReshapeFunc Function
glutReshapeFunc sets the reshape callback for the current window.

SYNTAX:
void glutReshapeFunc(void (*func)(int width, int height));

5.4MAIN FUNCTION

glutInit Function glutInit is used to


initialize the GLUT library.

SYNTAX:

glutInit(int *argcp, char **argv);

PARAMETERS:

 argcp - A pointer to the program's unmodified argc variable from main. Upon return, the
value pointed to by argcp will be updated, because glutInit extracts any command line
options intended for the GLUT library.
 Argv -
The program's unmodified argv variable from main. Like argcp, the data for argv will
be updated because glutInit extracts any command line options understood by the GLUT
library.
 glutInit(&argc,argv);

glutInitDisplayMode Function
glutInitDisplayMode sets the initial display mode.

SYNTAX:
void glutInitDisplayMode(unsigned int mode);

PARAMETERS:

 mode -
Display mode, normally the bitwise OR-ing of GLUT display mode bit masks. See values
below:

GLUT_RGB: An alias for GLUT_RGBA.


9|Page
Downloaded from WWW.VTULOOP.COM
Catch me

GLUT_DOUBLE:Bit mask to select a double buffered window. This overrides


GLUT_SINGLE.
GLUT_DEPTH: Bit mask to select a window with a depth buffer.

glutMainLoop Function
glutMainLoop enters the GLUT event processing loop.

SYNTAX:

void glutMainLoop(void);

Chapter-6
APPENDIX -A

SOURCE CODE
#include<GL/glut.h>
#include<stdlib.h>
#include<string.h>

void controls1();
void startmenu();
void aboutf(); void
lev();
void over();

int x,y,w,f=0,i,j,k,v,wwh=1024; int


hitFlag=0,messageTrue=0,startFlag=0,backFlag=0,controlsFlag=0,aboutFlag=0,dirFlag=0,upFlag=0,o
verFlag=0,levFlag;

char wel[100]="WELCOME TO 'CATCH ME' GAME...";


char start[50]="1: START GAME."; char
controls[50]="2: HOW TO PLAY."; char
about[50]="4: ABOUT GAME."; char
levels[50]="3: LEVELS.";
char control1[500]="HI...\n TO START WITH GAME, AN OBJECT WILL BE MOVING ON THE SCREEN.";

char control2[200]="YOU HAVE TO 'CATCH' THAT OBJECT BY CLICKING LEFT BUTTON OF THE
MOUSE ON THAT OBJECT.";

char control3[200]="THERE WILL BE TEN CHANCES AND EACH CHANCE CARRIES 10 POINTS.";

char control4[200]="AND YOU CAN CHOOSE DIFFERENT LEVELS IN THE GAME."; char
control5[200]="press '1' to START GAME and '3' to go 'ABOUT GAME' or LEFT CLICK to go
back.";
char control6[100]="********** ALL THE BEST **********";
char about1[100]="WELL, THE GAME NAME IS 'CATCH ME IF U CAN!!!'."; char
about2[100]="THIS GAME IS DEVELOPED BY DHEERAJ KUMAR & JIV RAJANI VAIBHAV "; char
about3[100]="FROM 6TH SEM CS USING OPENGL AS PART OF MINIPROJECT."; char
10 | P a g e
Downloaded from WWW.VTULOOP.COM
Catch me

about4[100]="press '1' to START GAME or '2' to go 'HOW TO PLAY GAME' or LEFT CLICK to go
back.";
char lev1[100]="CHOOSE THE LEVEL U WANT TO PLAY...";
char lev2[100]="a: EASY"; char lev3[100]="b: MEDIUM"; char
lev4[100]="c: HARD";
char lev5[100]="LEFT CLICK to go back."; char
over1[100]="GAME OVER!!!"; char well[100]="WELL
DONE!!!"; char yourscore[100]="YOUR SCORE IS:"; char
hardluck[100]="WELL, HARD LUCK, TRY AGAIN...";
char hundred[100]="100";
char max[100]="(please maximise the window before u start the game..)"; char
key1;
char sco[10]="SCORE:"; int
score=0,rem,vs1=0,vs2=0;
int yy1=660,yy2=750;
int level1=0,level2=0,level3=0;

struct lag
{
float x1,x2,y1,y2;
float color;
}o;

void mypos()
{
o.x1=90;
o.y1=100;
o.x2=o.x1+40;
o.y2=o.y1+40;
}

void initfun()
{
glMatrixMode(GL_PROJECTION);
glLoadIdentity(); gluOrtho2D(0,1280,0,1024);

mypos();
}

void moveRight()
{
if(level1==0&&level2==0&&level3==0) v=5;

if(level1==1)
v=5;
else if(level2==1)
v=10;
else if(level3==1)
v=15;

o.x1=o.x1+v;
o.y1=o.y1;
o.x2=o.x1+40;
o.y2=o.y1+40;
glutPostRedisplay();
}

void randomGenerate()
11 | P a g e
Downloaded from WWW.VTULOOP.COM
Catch me

f++;
if(f<10)
{
int num=rand()%620;
if(num<90) num=num+100;

o.x1=90;
o.y1=num;
o.x2=o.x1+40;
o.y2=o.y1+40;
hitFlag=0;
glutPostRedisplay();
}
else
over();
}

void display(void)
{

glClear(GL_COLOR_BUFFER_BIT);
if(startFlag==0)
{
glColor3f(1,1,1);
glRectf(0,0,800,600); glColor3f(0,0,0);
glRectf(10,10,1270,1014);
glColor3f(0.6,0.7,0.8);
glRasterPos2f(300,900);
for(w=0;w<sizeof(wel);w++)
glutBitmapCharacter(GLUT_BITMAP_HELVETICA_18,wel[w]);

glRasterPos2f(250,850);
for(w=0;w<sizeof(max);w++)
glutBitmapCharacter(GLUT_BITMAP_HELVETICA_18,max[w]);

glColor3f(0.5,0.1,0.7);
glRasterPos2f(200,700);
for(w=0;w<sizeof(start);w++)
glutBitmapCharacter(GLUT_BITMAP_HELVETICA_18,start[w]);

glColor3f(0.7,0.8,0.9);
glRasterPos2f(200,600);
for(w=0;w<sizeof(controls);w++)
glutBitmapCharacter(GLUT_BITMAP_HELVETICA_18,controls[w]);

glColor3f(0.2,0.5,0.7);
glRasterPos2f(200,500);
for(w=0;w<sizeof(levels);w++)
glutBitmapCharacter(GLUT_BITMAP_HELVETICA_18,levels[w]);

glColor3f(1.0,0.8,0.3);
glRasterPos2f(200,400);
for(w=0;w<sizeof(about);w++)
glutBitmapCharacter(GLUT_BITMAP_HELVETICA_18,about[w]);

12 | P a g e
Downloaded from WWW.VTULOOP.COM
Catch me

glFlush();
}

if(controlsFlag==1)
//to go controls window
{
controls1();
}

if(aboutFlag==1)
//to go about game window
{
aboutf();
}

if(levFlag==1)
{
lev();
}

if(startFlag==1) //to start game


{

glColor3f(100.0/256.0, 0.0, 0.0);

glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluOrtho2D(0,1280,0,1024);

glColor3f(1.0,100.0/256.0, 0.0);
glRectf(0,0,1280,1024);
glColor3f(220.0/256,150.0/256.0,0); //b1
glRectf(50,50,880,700);
glColor3f(0,100.0/256.0,0); //b2
glRectf(70,70,860,680);
glColor3f(0,0,0); //b3
glRectf(90,90,840,660);
vs2=score%10;
vs1=score/10;

glRasterPos2f(100,800);
for(i=0;i<sizeof(sco);i++)
glutBitmapCharacter(GLUT_BITMAP_HELVETICA_18,sco[i]);

glRasterPos2f(170,800);
glutBitmapCharacter(GLUT_BITMAP_HELVETICA_18,vs1+48);
glutBitmapCharacter(GLUT_BITMAP_HELVETICA_18,vs2+48);

if(hitFlag==0)
{
glColor3f(1.0,1.0,1.0); //object;
glRectf(o.x1,o.y1,o.x2,o.y2);
glFlush();

if(o.x2<=840)
moveRight();
if(o.x2>840)
randomGenerate();
13 | P a g e
Downloaded from WWW.VTULOOP.COM
Catch me

glFlush();

glColor3f(0,0,1);
glPointSize(5);
glBegin(GL_POINTS);
glVertex2f(x,y); glEnd();

if(hitFlag==1)
{
hitFlag=0;
glColor4f(1.0,1.0,1.0,1.0);
char b[20]={"hit..."},c[20]={"lost.."};

glRasterPos2f(o.x1,o.y1);
if(messageTrue==1)
{
score+=10;

for(int i=0;i<7;i++)
glutBitmapCharacter(GLUT_BITMAP_HELVETICA_18,b[i]);

/*while(score!=0)
{
rem=score%10;
glColor3f(0,0,0);
glRasterPos2f(100,800);

glutBitmapCharacter(GLUT_BITMAP_HELVETICA_18,48+rem);
score=score/10;
}*/

glFlush();
}

for(int t=0;t<1000;t++)
for(int h=0;h<1000;h++)
for(int y=0;y<100;y++)
{}
randomGenerate();

}
}
glFlush();
}
void over()
{

overFlag=0;
glColor3f(0.56,0.40,0.8);
glRectf(0,0,1280,1024);

glColor3f(0.0,0.0,0.0);
glRasterPos2f(500,700);
for(w=0;w<sizeof(over1);w++)
glutBitmapCharacter(GLUT_BITMAP_HELVETICA_18,over1[w]);

14 | P a g e
Downloaded from WWW.VTULOOP.COM
Catch me

if(score==100)
{
glRasterPos2f(400,600);
for(i=0;i<sizeof(well);i++)
glutBitmapCharacter(GLUT_BITMAP_HELVETICA_18,well[i]);
glRasterPos2f(400,400);
for(i=0;i<sizeof(yourscore);i++)
glutBitmapCharacter(GLUT_BITMAP_HELVETICA_18,yourscore[i]);

glRasterPos2f(570,400);
for(i=0;i<sizeof(hundred);i++)
glutBitmapCharacter(GLUT_BITMAP_HELVETICA_18,hundred[i]);
}
else
{
glRasterPos2f(400,600);
for(i=0;i<sizeof(yourscore);i++)
glutBitmapCharacter(GLUT_BITMAP_HELVETICA_18,yourscore[i]);
glRasterPos2f(570,600);
glutBitmapCharacter(GLUT_BITMAP_HELVETICA_18,vs1+48);
glutBitmapCharacter(GLUT_BITMAP_HELVETICA_18,vs2+48);
if(score==0)
{
glRasterPos2f(570,500);
for(i=0;i<sizeof(hardluck);i++)
glutBitmapCharacter(GLUT_BITMAP_HELVETICA_18,hardluck[i]);
}

}
glFlush();

for(i=0;i<50000;i++)
for(j=0;j<50000;j++)
//for(k=0;k<1000;k++)
{}
exit(1);
}

void controls1() //function for controls window


{
glColor3f(0.56,0.40,0.8);
glRectf(0,0,1280,1024);

glColor3f(0.3,0.45,0.76);
glRectf(20,20,1260,1004);

glColor3f(0.0,0.0,0.0);
glRasterPos2f(100,800);
for(w=0;w<sizeof(control1);w++)
glutBitmapCharacter(GLUT_BITMAP_HELVETICA_18,control1[w]);

glRasterPos2f(90,700);
for(w=0;w<sizeof(control2);w++)
glutBitmapCharacter(GLUT_BITMAP_HELVETICA_18,control2[w]);

glRasterPos2f(100,600);
for(w=0;w<sizeof(control3);w++)
glutBitmapCharacter(GLUT_BITMAP_HELVETICA_18,control3[w]);
15 | P a g e
Downloaded from WWW.VTULOOP.COM
Catch me

glRasterPos2f(100,500);
for(w=0;w<sizeof(control4);w++)
glutBitmapCharacter(GLUT_BITMAP_HELVETICA_18,control4[w]);

glRasterPos2f(100,400);
for(w=0;w<sizeof(control5);w++)
glutBitmapCharacter(GLUT_BITMAP_HELVETICA_18,control5[w]);

glRasterPos2f(200,300);
for(w=0;w<sizeof(control6);w++)
glutBitmapCharacter(GLUT_BITMAP_HELVETICA_18,control6[w]);

controlsFlag=0;
glFlush();
}
void aboutf()
//function for about game
{
glColor3f(1.0,0.40,1.0);
glRectf(0,0,1280,1024);
glColor3f(0.7,0.45,0.36);
glRectf(20,20,1260,1004);

glColor3f(0.0,0.0,0.0);
glRasterPos2f(100,800);
for(w=0;w<sizeof(about1);w++)
glutBitmapCharacter(GLUT_BITMAP_HELVETICA_18,about1[w]);

glRasterPos2f(100,700);
for(w=0;w<sizeof(about2);w++)
glutBitmapCharacter(GLUT_BITMAP_HELVETICA_18,about2[w]);

glRasterPos2f(100,600);
for(w=0;w<sizeof(about3);w++)
glutBitmapCharacter(GLUT_BITMAP_HELVETICA_18,about3[w]);

glRasterPos2f(100,500);
for(w=0;w<sizeof(about4);w++)
glutBitmapCharacter(GLUT_BITMAP_HELVETICA_18,about4[w]);

aboutFlag=0;
glFlush();
}

void startmenu()
{
if(dirFlag==1)
{
dirFlag=0;upFlag=0;

yy1-=100;
yy2-=100;
glColor3f(0.6,0.7,0.8);
glRasterPos2f(300,900);
for(w=0;w<sizeof(wel);w++)
glutBitmapCharacter(GLUT_BITMAP_HELVETICA_18,wel[w]);

16 | P a g e
Downloaded from WWW.VTULOOP.COM
Catch me

glRasterPos2f(250,850);
for(w=0;w<sizeof(max);w++)
glutBitmapCharacter(GLUT_BITMAP_HELVETICA_18,max[w]);

glColor3f(0.5,0.1,0.7);
glRasterPos2f(200,700);
for(w=0;w<sizeof(start);w++)
glutBitmapCharacter(GLUT_BITMAP_HELVETICA_18,start[w]);

glColor3f(0.7,0.8,0.9); glRasterPos2f(200,600);
for(w=0;w<sizeof(controls);w++)
glutBitmapCharacter(GLUT_BITMAP_HELVETICA_18,controls[w]);

glColor3f(0.2,0.5,0.7);
glRasterPos2f(200,500);
for(w=0;w<sizeof(levels);w++)
glutBitmapCharacter(GLUT_BITMAP_HELVETICA_18,levels[w]);
glColor3f(1.0,0.8,0.3); glRasterPos2f(200,400);
for(w=0;w<sizeof(about);w++)
glutBitmapCharacter(GLUT_BITMAP_HELVETICA_18,about[w]);

glFlush();

if(upFlag==1)
{
upFlag=0;dirFlag=0;
yy1+=100;
yy2+=100;

glColor3f(0.6,0.7,0.8);
glRasterPos2f(300,900);
for(w=0;w<sizeof(wel);w++)
glutBitmapCharacter(GLUT_BITMAP_HELVETICA_18,wel[w]);

glColor3f(0.5,0.1,0.7);
glRasterPos2f(200,700);
for(w=0;w<sizeof(start);w++)
glutBitmapCharacter(GLUT_BITMAP_HELVETICA_18,start[w]);

glColor3f(0.7,0.8,0.9);
glRasterPos2f(200,600);
for(w=0;w<sizeof(controls);w++)
glutBitmapCharacter(GLUT_BITMAP_HELVETICA_18,controls[w]);

glColor3f(0.2,0.5,0.7);
glRasterPos2f(200,500);
for(w=0;w<sizeof(levels);w++)
glutBitmapCharacter(GLUT_BITMAP_HELVETICA_18,levels[w]);

glColor3f(1.0,0.8,0.3);
glRasterPos2f(200,400);
for(w=0;w<sizeof(about);w++)
glutBitmapCharacter(GLUT_BITMAP_HELVETICA_18,about[w]);
17 | P a g e
Downloaded from WWW.VTULOOP.COM
Catch me

glFlush();
}

void lev()
{
glColor3f(0.5,0.5,0.5);
glRectf(0,0,1280,1024);

glColor3f(0,0,0);
glRasterPos2f(300,800); for(w=0;w<sizeof(lev1);w++)

glutBitmapCharacter(GLUT_BITMAP_HELVETICA_18,lev1[w]);

glRasterPos2f(300,700);
for(w=0;w<sizeof(lev2);w++)

glutBitmapCharacter(GLUT_BITMAP_HELVETICA_18,lev2[
w]);

glRasterPos2f(300,600);
for(w=0;w<sizeof(lev3);w++)
glutBitmapCharacter(GLUT_BITMAP_HELVETICA_18,lev3[w]);

glRasterPos2f(300,400);
for(w=0;w<sizeof(lev5);w++)
glutBitmapCharacter(GLUT_BITMAP_HELVETICA_18,lev5[w]);

glRasterPos2f(300,500);
for(w=0;w<sizeof(lev4);w++)
glutBitmapCharacter(GLUT_BITMAP_HELVETICA_18,lev4[w]);

levFlag=0;
glFlush();
}

void keyboard(unsigned char key,int mx,int my)


{
if(key=='1')
startFlag=1;
if(key=='2')
controlsFlag=1;
if(key=='4')
aboutFlag=1;
if(key=='3')
levFlag=1;
if(key=='a')
level1=1;
if(key=='b')
level2=1;
if(key=='c')
level3=1;

glutPostRedisplay();

18 | P a g e
Downloaded from WWW.VTULOOP.COM
Catch me

void mouse(int b,int s,int mx,int my)


{

x=mx;
y=wwh-my;

if(x>=o.x1 && x<o.x1+40 && y>=o.y1 && y<=o.y1+40 )


{
hitFlag=1; messageTrue=1;
}

glutPostRedisplay();
}
void reshape(int ww,int wh)
{
wwh=wh;
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluOrtho2D(0,ww,0,wh); mypos();
}

int main(int argc, char** argv)


{
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB);
glutInitWindowSize(1280,1024);
glutInitWindowPosition(0.0,0.0);
glutCreateWindow("CATCH ME IF U CAN!!!");

initfun();
glutDisplayFunc(display);

glutKeyboardFunc(keyboard);
glutMouseFunc(mouse);
glutReshapeFunc(reshape);

glutMainLoop();
return 0;
}

19 | P a g e
Downloaded from WWW.VTULOOP.COM
Catch me

Chapter-7 SNAP SHOTS

FIG:C) START GAME

20 | P a g e
Downloaded from WWW.VTULOOP.COM
Catch me

FIG:D) SELECT LEVEL

FIG:E) MOUSE POINTING

21 | P a g e
Downloaded from WWW.VTULOOP.COM
Catch me

FIG:F) MOUSE HITTING

22 | P a g e
Downloaded from WWW.VTULOOP.COM
Catch me

FIG :G) SCORE INTERFACE

Chapter-8
Conclusion

The project was started with the designing phase in which I figured the requirements needed,
the layout design, then comes the detail designing of each function after which, was the
testing and debugging stage.

We have tried to implement the project making it as user-friendly and error free as possible.
We regret any errors that may have inadvertently crept in.

23 | P a g e
Downloaded from WWW.VTULOOP.COM
Catch me

BIBLIOGRAPHY

[1] OpenGL Programming Guide (Addison-Wesley Publishing Company)

[2] The OpenGL Utility Toolkit (GLUT)Programming Interface


-API Version 3 BY MARK J. KILGARD

[3] Interactive computer graphics


-A top down approach by using Open GL by EDWARD ANGEL

24 | P a g e
Downloaded from WWW.VTULOOP.COM
Catch me

25 | P a g e
Downloaded from WWW.VTULOOP.COM

You might also like