Вы находитесь на странице: 1из 52

.

DON BOSCO INSTITUTE OF


TECHNOLOGY
Bangalore 560 074
DEPARTMENT OF COMPUTER SCIENCE &
ENGINEERING

HAWK-EYE
Submitted in partial fulfillment of requirements
of

VI semester, Computer
Science

Submitted by:
PAVAN S (1DB06CS033)
&
GURU PRASAD P (1DB06CS015)

UNDER THE GUIDANCE OF

Ms. Hemapriya
Lecturer, Dept of CSE
DBIT

DEPARTMENT OF CSE 2009 Page 2


DON BOSCO INSTITUTE OF TECHNOLOGY, BANGALORE
DEPARTMENT OF COMPUTER SCIENCE

CERTIFICATE

This is to certify that PAVAN S(1DB06CS033) and GURU PRASAD P(1DB06CS015) have
successfully completed the project work on ‘HAWK-EYE’ and submitted in partial
fulfillment of the requirements of 6 semester B.E., Computer Science and Engineering,
prescribed by the VISVESVARAYA TECHNOLOGICAL UNIVERSITY during the
academic year 2006-2007.

Ms. HEMAPRIYA Mr. NAGARAJ


Lecturer, CSE HOD, Dept of CSE

Signature of examiners:

1……………………..

2……………………..

DEPARTMENT OF CSE 2009 Page 3


ACKNOWLEDGEMENT

We are grateful to our institution, which helped us in many ways. Our

sincere thanks to Prof. Mr.Murulidhar the principal of our institution for having

permitted to develop this project.

We shall thank our Head of Department Mr.Nagaraj, who has been a

source of inspiration throughout our project work.

We are highly thankful and indebted to our project guide Ms.Hemapriya,

Lecturer, Computer Science Department. Finally we also thank all non-teaching

staff of Computer Science Department for their help in successful completion of

our project.

PAVAN.S

GURU PRASAD.P

DEPARTMENT OF CSE 2009 Page 4


SYNOPSIS

Computer Graphics is one of the major facets in the computer


industry. With the help of graphics package many applications like
gaming, paint brush, entertainment, movies and other innovative
applications can be run.

The designed HAWK-EYE is to show how the LBW(leg before


the wicket)can be simulated using the Computer graphics.

The HAWK-EYE is interfaced with the MOUSE. We are using


the different BUTTONS for working of the HAWK-EYE. The HAWK-
EYE can JUDGE the ball pitched inside the yellow zone or not.

This HAWK-EYE is a simple and very basic demonstration of the


application of computer graphics.

Therefore, as a whole, this is a simple and useful


demonstration for developing the interest in the graphics field of
computers.

DEPARTMENT OF CSE 2009 Page 5


INDEX PAGE

1. Introduction

2. Requirement Specifications

2.1 Hardware Configuration


2.1 Software Configuration

3. System Design

3.1 Algorithms
3.2 Modules and their descriptions
4.2.1 Inbuilt Functions
4.2.2 User defined functions
3.3 Source code

4.Conclusion

5.Bibliography

DEPARTMENT OF CSE 2009 Page 6


INTRODUCTION
1.1 OVERVIEW
The Computer Graphics is one of the most effective and commonly used methods to
communicate the processed information to the user. It displays the information in the form of
graphics objects such as pictures, charts, graphs and diagram instead of simple text.
In computer graphics, pictures or graphics objects are presented as a collection of
discrete picture elements called pixels. The pixel is the smallest addressable screen element
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 a keyboard, mouse, or touch-sensitive panel on the screen
Computer graphics concerns with the pictorial synthesis of real or imaginary objects
from their computer based models, where as the related field of image processing treats the
converse process ,the analysis of scenes ,or the reconstruction of models of 2D or 3D objects
from their pictures.
The image processing can be classified as
• Image enhancement.
• Pattern detection and recognition
• Scene analysis and computer vision.
The image enhancement deals with the improvement in the image quality by
eliminating noise or by increasing image contrast. Pattern detection and recognition deals
with the detection and clarification of standard patterns
and finding deviations from these patterns .The optical character recognition (OCR)
technology is an practical example for pattern detection & recognition. Scene analysis deals
with the recognition and reconstruction of 3D model of scene from several 2D images.

DEPARTMENT OF CSE 2009 Page 7


1.2 ADVANTAGES OF INTERACTIVE GRAPHICS

It provide a tool for producing pictures not only of concrete, ”real-world” objects but
also of abstract ,synthesis of objects.
• It as an ability to show moving pictures, and thus it is possible to produce animations.
• With the use of interactive graphics we can control the movement of an object. The
interactive graphics provides tool called motion dynamics. With this tool user can
move and tumble objects with respect to stationary observer, or he can make object
stationary and the viewer moving around them.
• Interactive graphics provides facility called update dynamics.
• With the recent development of digital signal processing (DSP) and audio synthesis
chip the interactive graphics can now provide audio feed back along with the
graphical feed backs to make the simulated environment even more realistic

1.3 AREAS OF APPLICATION OF COMPUTER GRAPHICS

• User interfaces
• Plotting of graphs and charts
• Office automation and Desktop publishing
• Computer aided Drafting and designs
• Process control
• Cartography

OPENGL PROGRAMMING LANGUAGE:

As a software interface for graphics hardware, OpenGL's 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).
OpenGL performs several processing steps on this data to convert it to pixels to form the final
desired image in the frame buffer.

DEPARTMENT OF CSE 2009 Page 8


2.REQUIREMENT SPECIFICATION.
2.1 Hardware Specification Details

 Processor : Intel 386 onwards Compatible Hardware.


 RAM : 16Mb RAM
 Hard Disk : 3.1 GB
 Monitor : EGVGA Compatible
 Keyboard : Standard 101 key Keyboard
 Backup Media : Floppy / Hard disk
 Mouse(ps/2),Printer (optional)

2.2 Software Specification Details

 Operating System : window 98/higher, window XP with dos


environment/windows vista.
 Language Tool : OpenGL
 Compiler : GNU GCC Compiler /C++ complier.
 Libraries : Supporting glut32.h, opengl32.h & glu32.h .
 Documentation Tool : Visual C++ 6 or higer versions like 2008.

DEPARTMENT OF CSE 2009 Page 9


3. DESIGN
3.1 Algorithms

2D TRANSFORMATIONS [Translation]

Step 1: Initialize and draw the input object.


Step 2: Accept the necessary input data (such as distance parameter, rotation angle, point of
reference, shear parameters, scaling parameter) required for step 3
Step 3: To perform
Translation:
x’ = x + dx & y’ = y + dy

3.2 Modules and their descriptions


3.2.1 Inbuilt functions

• glClearColor()
• glClear()
• glPushMatrix()
• glTranslatef()
• glColor3f()
• glPopMatrix()
• glutSwapBuffers()
• glLoadIdentity()
• glRasterPos2f()
• glutBitmapCharacter()
• glutPostRedisplay()
• glOrtho2D()
• glutInit()
• glutInitDisplayMode()

DEPARTMENT OF CSE 2009 Page 10


• glutInitWindowPosition()
• glutCreateWindow()
• init()
• glutDisplayFunc()
• glutReshapeFunc()
• glutMouseFunc()
• glutIdleFunc()
• glutMainLoop()

3.2.2 User defined functions

• Sprint()
• display()

• spindisplay()

• spindisplayy()

USER DEFINED FUNCTIONS:

This project is completed by using some of the Primary functions,first we


finished with the ground dimensions using glBegin(GL_LINES)of
width 5.0units ,next we did the patches on ground usin glColor[34]{f}();

then we drew pitch of dimensions 150units width,350units long.Which is done


with the help of GL_POLYGON..

The screase on pitch is drawn using GL_LINES on appropriate length of


the pitch and using same functions we did with STUMPS but of different
width line. As we finished with stumps,next bails on the stumps is drawn by
using glLineWidth() function,using same function screase on the pitch is
drawn. Next we used Stroke manner of displaying STRINGS using set of
polygons. Then we constructed fences using solid parellelogram,using
GL_POLYGON and they are filled with blue and yellow color alternative

DEPARTMENT OF CSE 2009 Page 11


fashion. Then by using primitive function glutSolidSphere(GLdouble
radius,GLint slices,GLint stacks);we finished with the ball.

Next we placed the ball(i.e solid spehre) in appropriate position on the


pitch,then we used translate() function and swapbuffers(); function in order to
get movement of ball,this is achieved in project by LEFTCLICK of MOUSE
button,the interaction is achieved by glutMouseFunc(mouse); in our project.as
we press the MIDDLE_BUTTON we can observe the hault of the ball and
again pressing the RIGHT_BUTTON we can easily judge the whether
batsman is OUT or NOT!!

We have used the function Sprint() to print the message the display using
bitmap characters.

Spindisplay() function is used move the ball before it pitches.

Spindisplayy() function is used move the ball after it pitches.

DEPARTMENT OF CSE 2009 Page 12


3.3 SOURCE CODE

#include<GL/glut.h>

#include<math.h>

#include<stdlib.h>

#include<stdio.h>

#include<string.h>

static GLfloat spin=45.0,spin1=200.0,bail=1.0,ball=1.0;

void Sprint( int x, int y, char *st)

int l,i;

l=strlen( st ); // see how many characters are in text string.

glRasterPos2i( x, y); // location to start printing text

for( i=0; i < l; i++) // loop until i is greater then l

glutBitmapCharacter(GLUT_BITMAP_TIMES_ROMAN_24,
st[i]); // Print a character on the screen

DEPARTMENT OF CSE 2009 Page 13


}

void display()

glClear(GL_COLOR_BUFFER_BIT);

//CODE FOR BOUNDRY

glColor3f(1.0,1.0,1.0);

glLineWidth(5.0);

glBegin(GL_LINES);

glVertex2f(20.0,1.0);

glVertex2f(10.0,50.0);

glVertex2f(10.0,50.0);

glVertex2f(1.0,200.0);

glVertex2f(1.0,200.0);

glVertex2f(1.0,350.0);

glVertex2f(1.0,350.0);

DEPARTMENT OF CSE 2009 Page 14


glVertex2f(10.0,475.0);

glVertex2f(10.0,475.0);

glVertex2f(30.0,525.0);

glVertex2f(30.0,525.0);

glVertex2f(70.0,525.0);

glVertex2f(70.0,525.0);

glVertex2f(85.0,475.0);

glVertex2f(85.0,475.0);

glVertex2f(95.0,350.0);

glVertex2f(95.0,350.0);

glVertex2f(95.0,100.0);

glVertex2f(95.0,100.0);

glVertex2f(85.0,1.0);

glVertex2f(85.0,1.0);

glVertex2f(20.0,1.0);

glEnd();

//CODE FOR FIRST SHADE

DEPARTMENT OF CSE 2009 Page 15


glColor3f(0.0,0.7,0.0);

glBegin(GL_POLYGON);

glVertex2f(10.0,475.0);

glVertex2f(1.0,350.0);

glVertex2f(95.0,350.0);

glVertex2f(85.0,475.0);

glEnd();

//CODE FOR SECOND SHADE

glColor3f(0.0,0.7,0.0);

glBegin(GL_POLYGON);

glVertex2f(10.0,50.0);

glVertex2f(3.0,175.0);

glVertex2f(95.0,175.0);

glVertex2f(95.0,100.0);

glVertex2f(90.0,50.0);

glEnd();

//CODE FOR THIRD SHADE

DEPARTMENT OF CSE 2009 Page 16


glColor3f(0.0,0.7,0.0);

glBegin(GL_POLYGON);

glVertex2f(10.0,475.0);

glVertex2f(30.0,525.0);

glVertex2f(30.0,1.0);

glVertex2f(20.0,1.0);

glVertex2f(10.0,50.0);

glEnd();

//CODE FOR FIRST SQUARE SHADE

glColor3f(0.0,0.6,0.0);

glBegin(GL_POLYGON);

glVertex2f(10.0,50.0);

glVertex2f(30.0,50.0);

glVertex2f(30.0,175.0);

glVertex2f(10.0,175.0);

glEnd();

//CODE FOR SECOND SQUARE SHADE

DEPARTMENT OF CSE 2009 Page 17


glColor3f(0.0,0.6,0.0);

glBegin(GL_POLYGON);

glVertex2f(10.0,475.0);

glVertex2f(30.0,475.0);

glVertex2f(30.0,350.0);

glVertex2f(10.0,350.0);

glEnd();

//CODE FOR FOURTH SHADE

glColor3f(0.0,0.7,0.0);

glBegin(GL_POLYGON);

glVertex2f(65.0,525.0);

glVertex2f(70.0,525.0);

glVertex2f(85.0,475.0);

glVertex2f(85.0,1.0);

glVertex2f(65.0,1.0);

glEnd();

//CODE FOR THIRD SQUARE SHADE

DEPARTMENT OF CSE 2009 Page 18


glColor3f(0.0,0.6,0.0);

glBegin(GL_POLYGON);

glVertex2f(65.0,475.0);

glVertex2f(85.0,475.0);

glVertex2f(85.0,350.0);

glVertex2f(65.0,350.0);

glEnd();

//CODE FOR FOURTH SQUARE SHADE

glColor3f(0.0,0.6,0.0);

glBegin(GL_POLYGON);

glVertex2f(65.0,50.0);

glVertex2f(85.0,50.0);

glVertex2f(85.0,175.0);

glVertex2f(65.0,175.0);

glEnd();

//CODE FOR PITCH

glColor3f(0.5,0.7,0.0);

DEPARTMENT OF CSE 2009 Page 19


glBegin(GL_POLYGON);

glVertex3f(45.0,405.0,0.0);

glVertex3f(45.0,132.0,0.0);

glVertex3f(55.0,132.0,0.0);

glVertex3f(55.0,405.0,0.0);

glEnd();

//CODE FOR LBW REFERENCE LINE

glColor3f(1.5,1.5,0.0);

glBegin(GL_POLYGON);

glVertex2f(49.0,187.0);

glVertex2f(51.0,187.0);

glVertex2f(51.0,370.0);

glVertex2f(49.0,370.0);

glEnd();

//CODE FOR CREASE

glColor3f(1.0,1.0,1.0);

glBegin(GL_LINES);

DEPARTMENT OF CSE 2009 Page 20


glVertex2f(40.0,350.0);

glVertex2f(60.0,350.0);

glVertex2f(40.0,187.0);

glVertex2f(60.0,187.0);

glVertex2f(45.0,370.0);

glVertex2f(55.0,370.0);

glVertex2f(45.0,157.0);

glVertex2f(55.0,157.0);

glVertex2f(45.0,405.0);

glVertex2f(45.0,350.0);

glVertex2f(55.0,405.0);

glVertex2f(55.0,350.0);

glVertex2f(45.0,132.0);

glVertex2f(45.0,187.0);

glVertex2f(55.0,132.0);

glVertex2f(55.0,187.0);

glEnd();

DEPARTMENT OF CSE 2009 Page 21


//CODE FOR WICKETS ON STRIKER SIDE

glBegin(GL_LINES);

//FIRST WICKET

glColor3f(0.9,0.9,0.9);

glVertex2f(51.0,410.0);

glVertex2f(51.0,370.0);

glColor3f(0.0,0.0,0.0);

glVertex2f(51.0,370.0);

glVertex2f(49.0,390.0);

//SECOND WICKET

glColor3f(0.9,0.9,0.9);

glVertex2f(50.0,410.0);

glVertex2f(50.0,370.0);

glColor3f(0.0,0.0,0.0);

glVertex2f(50.0,370.0);

glVertex2f(48.0,390.0);

//THIRD WICKET

DEPARTMENT OF CSE 2009 Page 22


glColor3f(0.9,0.9,0.9);

glVertex2f(49.0,410.0);

glVertex2f(49.0,370.0);

glColor3f(0.0,0.0,0.0);

glVertex2f(49.0,370.0);

glVertex2f(47.0,390.0);

glEnd();

//CODE FOR WICKET ON NON STRIKER SIDE

glBegin(GL_LINES);

//FIRST WICKET

glColor3f(0.9,0.9,0.9);

glVertex2f(51.0,157.0);

glVertex2f(51.0,197.0);

glColor3f(0.0,0.0,0.0);

glVertex2f(51.0,157.0);

glVertex2f(49.0,177.0);

//SECOND WICKET

DEPARTMENT OF CSE 2009 Page 23


glColor3f(0.9,0.9,0.9);

glVertex2f(50.0,157.0);

glVertex2f(50.0,197.0);

glColor3f(0.0,0.0,0.0);

glVertex2f(50.0,157.0);

glVertex2f(48.0,177.0);

//THIRD WICKET

glColor3f(0.9,0.9,0.9);

glVertex2f(49.0,157.0);

glVertex2f(49.0,197.0);

glColor3f(0.0,0.0,0.0);

glVertex2f(49.0,157.0);

glVertex2f(47.0,177.0);

glEnd();

//CODE FOR BAILS

glColor3f(1.0,1.0,1.0);

glLineWidth(1.0);

DEPARTMENT OF CSE 2009 Page 24


glBegin(GL_LINES);

glVertex2f(49.0,197.0);

glVertex2f(49.2,197.0);

glEnd();

glLineWidth(5.0);

glBegin(GL_LINES);

glVertex2f(49.2,197.0);

glVertex2f(49.8,197.0);

glEnd();

glLineWidth(1.0);

glBegin(GL_LINES);

glVertex2f(49.8,197.0);

glVertex2f(50.0,197.0);

glEnd();

glLineWidth(1.0);

glBegin(GL_LINES);

glVertex2f(50.0,197.0);

DEPARTMENT OF CSE 2009 Page 25


glVertex2f(50.2,197.0);

glEnd();

glLineWidth(5.0);

glBegin(GL_LINES);

glVertex2f(50.2,197.0);

glVertex2f(50.8,197.0);

glEnd();

glLineWidth(1.0);

glBegin(GL_LINES);

glVertex2f(50.8,197.0);

glVertex2f(51.0,197.0);

glEnd();

if(bail==1.0)

glLineWidth(1.0);

glBegin(GL_LINES);

glVertex2f(49.0,410.0);

DEPARTMENT OF CSE 2009 Page 26


glVertex2f(49.2,410.0);

glEnd();

glLineWidth(5.0);

glBegin(GL_LINES);

glVertex2f(49.2,410.0);

glVertex2f(49.8,410.0);

glEnd();

glLineWidth(1.0);

glBegin(GL_LINES);

glVertex2f(49.8,410.0);

glVertex2f(50.0,410.0);

glEnd();

glLineWidth(1.0);

glBegin(GL_LINES);

glVertex2f(50.0,410.0);

glVertex2f(50.2,410.0);

glEnd();

DEPARTMENT OF CSE 2009 Page 27


glLineWidth(5.0);

glBegin(GL_LINES);

glVertex2f(50.2,410.0);

glVertex2f(50.8,410.0);

glEnd();

glLineWidth(1.0);

glBegin(GL_LINES);

glVertex2f(50.8,410.0);

glVertex2f(51.0,410.0);

glEnd();

//CODE FOR SHADOW OF BAILS

glColor3f(0.0,0.0,0.0);

glLineWidth(1.0);

glBegin(GL_LINES);

glVertex2f(47.0,177.0);

glVertex2f(47.2,177.0);

DEPARTMENT OF CSE 2009 Page 28


glEnd();

glLineWidth(5.0);

glBegin(GL_LINES);

glVertex2f(47.2,177.0);

glVertex2f(47.8,177.0);

glEnd();

glLineWidth(1.0);

glBegin(GL_LINES);

glVertex2f(47.8,177.0);

glVertex2f(48.0,177.0);

glEnd();

glLineWidth(1.0);

glBegin(GL_LINES);

glVertex2f(48.0,177.0);

glVertex2f(48.2,177.0);

glEnd();

glLineWidth(5.0);

DEPARTMENT OF CSE 2009 Page 29


glBegin(GL_LINES);

glVertex2f(48.2,177.0);

glVertex2f(48.8,177.0);

glEnd();

glLineWidth(1.0);

glBegin(GL_LINES);

glVertex2f(48.8,177.0);

glVertex2f(49.0,177.0);

glEnd();

if(bail==1.0)

glLineWidth(1.0);

glBegin(GL_LINES);

glVertex2f(47.0,390.0);

glVertex2f(47.2,390.0);

glEnd();

glLineWidth(5.0);

DEPARTMENT OF CSE 2009 Page 30


glBegin(GL_LINES);

glVertex2f(47.2,390.0);

glVertex2f(47.8,390.0);

glEnd();

glLineWidth(1.0);

glBegin(GL_LINES);

glVertex2f(47.8,390.0);

glVertex2f(48.0,390.0);

glEnd();

glLineWidth(1.0);

glBegin(GL_LINES);

glVertex2f(48.0,390.0);

glVertex2f(48.2,390.0);

glEnd();

glLineWidth(5.0);

glBegin(GL_LINES);

glVertex2f(48.2,390.0);

DEPARTMENT OF CSE 2009 Page 31


glVertex2f(48.8,390.0);

glEnd();

glLineWidth(1.0);

glBegin(GL_LINES);

glVertex2f(48.8,390.0);

glVertex2f(49.0,390.0);

glEnd();

//CODE FOR ADVERTISEMENT BOARD

//CODE FOR FIRST BLUE BOARD AND ITS SHADOW

glColor3f(0.0,0.0,0.0);

glBegin(GL_POLYGON);

glVertex2f(1.0,350.0);

glVertex2f(0.0,410.0);

glVertex2f(10.0,550.0);

glVertex2f(10.0,475.0);

glEnd();

DEPARTMENT OF CSE 2009 Page 32


glColor3f(0.0,0.0,1.0);

glBegin(GL_POLYGON);

glVertex2f(1.0,350.0);

glVertex2f(10.0,475.0);

glVertex2f(10.0,525.0);

glVertex2f(1.0,400.0);

glEnd();

//CODE FOR SECOND BLUE BOARD AND ITS SHADOW

glColor3f(0.0,0.0,0.0);

glBegin(GL_POLYGON);

glVertex2f(10.0,475.0);

glVertex2f(10.0,550.0);

glVertex2f(30.0,550.0);

glEnd();

glColor3f(0.0,0.0,1.0);

glBegin(GL_POLYGON);

glVertex2f(10.0,475.0);

DEPARTMENT OF CSE 2009 Page 33


glVertex2f(30.0,525.0);

glVertex2f(30.0,550.0);

glVertex2f(10.0,525.0);

glEnd();

//CODE FOR THIRD BLUE BOARD AND ITS SHADOW

glColor3f(0.0,0.0,0.0);

glBegin(GL_POLYGON);

glVertex2f(70.0,550.0);

glVertex2f(85.0,540.0);

glVertex2f(85.0,525.0);

glEnd();

glColor3f(0.0,0.0,1.0);

glBegin(GL_POLYGON);

glVertex2f(70.0,525.0);

glVertex2f(70.0,555.0);

glVertex2f(85.0,525.0);

glVertex2f(85.0,475.0);

DEPARTMENT OF CSE 2009 Page 34


glEnd();

//CODE FOR FOURTH BLUE BOARD AND ITS SHADOW

glColor3f(0.0,0.0,0.0);

glBegin(GL_POLYGON);

glVertex2f(85.0,525.0);

glVertex2f(85.0,540.0);

glVertex2f(95.0,425.0);

glVertex2f(95.0,350.0);

glEnd();

glColor3f(0.0,0.0,1.0);

glBegin(GL_POLYGON);

glVertex2f(85.0,525.0);

glVertex2f(85.0,475.0);

glVertex2f(95.0,350.0);

glVertex2f(95.0,400.0);

glEnd();

//CODE FOR FIRST YELLOW BOARD.

DEPARTMENT OF CSE 2009 Page 35


glColor3f(1.0,1.0,0.0);

glBegin(GL_POLYGON);

glVertex2f(30.0,550.0);

glVertex2f(70.0,550.0);

glVertex2f(70.0,525.0);

glVertex2f(30.0,525.0);

glEnd();

glColor3f(0.0,0.0,1.0);

Sprint(43,530,"HAWK-EYE");//To display project name.

//CODE FOR SECOND YELLOW BOARD

glColor3f(1.0,1.0,0.0);

glBegin(GL_POLYGON);

glVertex2f(95.0,350.0);

glVertex2f(95.0,435.0);

glVertex2f(98.0,150.0);

glVertex2f(95.0,100.0);

glEnd();

DEPARTMENT OF CSE 2009 Page 36


//CODE FOR THIRD YELLOW BOARD

glColor3f(1.0,1.0,0.0);

glBegin(GL_POLYGON);

glVertex2f(1.0,350.0);

glVertex2f(0.0,400.0);

glVertex2f(0.0,200.0);

glVertex2f(1.0,200.0);

glEnd();

//CODE FOR FIFTH BLUE BOARD

glColor3f(0.0,0.0,1.0);

glBegin(GL_POLYGON);

glVertex2f(0.0,200.0);

glVertex2f(1.0,200.0);

glVertex2f(10.0,50.0);

glVertex2f(6.0,80.0);

glEnd();

//CODE FOR FOURTH YELLOW BOARD

DEPARTMENT OF CSE 2009 Page 37


glColor3f(1.0,1.0,0.0);

glBegin(GL_POLYGON);

glVertex2f(10.0,50.0);

glVertex2f(6.0,80.0);

glVertex2f(15.0,10.0);

glVertex2f(20.0,0.0);

glEnd();

//CODE FOR SIXTH BLUE BOARD

glColor3f(0.0,0.0,1.0);

glBegin(GL_POLYGON);

glVertex2f(95.0,100.0);

glVertex2f(85.0,1.0);

glVertex2f(90.0,30.0);

glVertex2f(98.0,150.0);

glEnd();

//CODE FOR GURU

glColor3f(0.0,0.5,0.0);

DEPARTMENT OF CSE 2009 Page 38


glLineWidth(10.0);

glBegin(GL_LINES);

glVertex2f(10.0,230.0);

glVertex2f(10.0,280.0);

glVertex2f(10.0,280.0);

glVertex2f(11.0,300.0);

glVertex2f(11.0,300.0);

glVertex2f(15.0,300.0);

glVertex2f(15.0,300.0);

glVertex2f(15.0,290.0);

glVertex2f(10.0,230.0);

glVertex2f(11.0,210.0);

glVertex2f(11.0,210.0);

glVertex2f(15.0,210.0);

glVertex2f(15.0,210.0);

glVertex2f(15.0,245.0);

glVertex2f(15.0,245.0);

DEPARTMENT OF CSE 2009 Page 39


glVertex2f(12.0,245.0);

glVertex2f(17.0,210.0);

glVertex2f(17.0,300.0);

glVertex2f(20.0,300.0);

glVertex2f(20.0,210.0);

glVertex2f(17.0,210.0);

glVertex2f(20.0,210.0);

glVertex2f(22.0,208.0);

glVertex2f(22.0,300.0);

glVertex2f(22.0,300.0);

glVertex2f(25.0,300.0);

glVertex2f(25.0,300.0);

glVertex2f(25.0,250.0);

glVertex2f(25.0,250.0);

glVertex2f(22.0,250.0);

glVertex2f(23.0,250.0);

glVertex2f(25.0,208.0);

DEPARTMENT OF CSE 2009 Page 40


glVertex2f(27.0,210.0);

glVertex2f(27.0,300.0);

glVertex2f(27.0,210.0);

glVertex2f(30.0,210.0);

glVertex2f(30.0,210.0);

glVertex2f(30.0,300.0);

glEnd();

//MESSAGE DISPLAY

glColor3f(0.0,0.0,0.0);

Sprint(30, 100, "press left mouse button to move ball");

Sprint(30, 80, "press right mouse button to pitch the ball");

Sprint(30, 60, "press middle mouse button to stop ball");

//CODE FOR PAVAN

glColor3f(0.0,0.5,0.0);

glLineWidth(10.0);

glBegin(GL_LINES);

glVertex2f(66.0,208.0);

DEPARTMENT OF CSE 2009 Page 41


glVertex2f(66.0,300.0);

glVertex2f(66.0,300.0);

glVertex2f(69.3,300.0);

glVertex2f(69.3,300.0);

glVertex2f(69.3,250.0);

glVertex2f(69.3,250.0);

glVertex2f(66.0,250.0);

glVertex2f(70.0,208.0);

glVertex2f(72.0,303.0);

glVertex2f(72.0,303.0);

glVertex2f(74.0,208.0);

glVertex2f(71.0,245.0);

glVertex2f(73.0,245.0);

glVertex2f(74.0,300.0);

glVertex2f(76.0,208.0);

glVertex2f(76.0,208.0);

glVertex2f(78.0,300.0);

DEPARTMENT OF CSE 2009 Page 42


glVertex2f(78.0,208.0);

glVertex2f(80.0,303.0);

glVertex2f(80.0,303.0);

glVertex2f(82.0,208.0);

glVertex2f(79.0,245.0);

glVertex2f(81.0,245.0);

glVertex2f(83.0,208.0);

glVertex2f(83.0,303.0);

glVertex2f(83.0,303.0);

glVertex2f(86.0,208.0);

glVertex2f(86.0,208.0);

glVertex2f(86.0,303.0);

glEnd();

//CODE FOR BALL AND ITS TRANSLATION

if(ball==1.0)

glPushMatrix();

DEPARTMENT OF CSE 2009 Page 43


glTranslatef(spin,spin1,-15.0);//specify the position where the
translation should start.

glColor3f(1.0,0.0,0.0);

glutSolidSphere(1.00000,400,421);//ball

glPopMatrix();

glutSwapBuffers();

glFlush();

//CODE FOR MOVEMENT OF BALL BEFORE PITCHING.

void spindisplay()

spin=spin+0.04;

spin1=spin1+1.0;

glutPostRedisplay();

//CODE FOR MOVEMENT OF BALL AFTER PITCHING

void spindisplayy()

DEPARTMENT OF CSE 2009 Page 44


{

static GLfloat spiny=spin1,spinx=spin;

ball=0.0;

if(spinx>=49.0&&spinx<=51.0)

glColor3f(0.0,0.0,0.0);

Sprint(53,310,"pitched inside");

else

glColor3f(0.0,0.0,0.0);

Sprint(30,260,"pitched outside");

glPushMatrix();

glTranslatef(spinx,spiny,-15.0);

glColor3f(1.0,0.0,0.0);

glutSolidSphere(1.00000,400,421);

DEPARTMENT OF CSE 2009 Page 45


glPopMatrix();

glutSwapBuffers();

spiny=spiny+0.5;

if(spinx>=49.0&&spinx<=51.0&&spiny>=410.0)

bail=0.0;//make the bails disappear.

glutPostRedisplay();

//CODE FOR MOUSE INTERACTION

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

switch(button)

case GLUT_LEFT_BUTTON:

if(state==GLUT_DOWN)

DEPARTMENT OF CSE 2009 Page 46


glutIdleFunc(spindisplay);

break;

case GLUT_MIDDLE_BUTTON:

if(state==GLUT_DOWN)

glutIdleFunc(NULL);

break;

case GLUT_RIGHT_BUTTON:

if(state==GLUT_DOWN)

glutIdleFunc(spindisplayy);

break;

default:

break;

int main(int argc,char**argv)

DEPARTMENT OF CSE 2009 Page 47


{

glutInit(&argc,argv);

glutInitDisplayMode(GLUT_DOUBLE|GLUT_RGB);

glutInitWindowSize(500,500);

glutInitWindowPosition(30,30);

glutCreateWindow("ppp");

glClearColor(0.0,0.6,0.0,0.0);

glOrtho(0.0,100.0,0.0,550.0,-15.0,50.0);

glutDisplayFunc(display);

glutMouseFunc(mouse);

glutMainLoop();

return(0);

DEPARTMENT OF CSE 2009 Page 48


OUTPUT

DEPARTMENT OF CSE 2009 Page 49


DEPARTMENT OF CSE 2009 Page 50
DEPARTMENT OF CSE 2009 Page 51
4.CONCLUSION
This project was implemented using OpenGL. This project provides us the
information about various features of a hawk eye. This project also helps us to
analyze how we can use the different standard functions for creating the animated
objects and can be used for making a gaming package. This package is very useful for
the users since it provides the basic information about various OpenGL functions
used for hawk eye.
This product has been demonstrated to fulfill the requirements. The functionality of
all the modules and the module level integration is found to be satisfactory.

5. BIBILOGRAPHY

Books referred
• Interactive Computer graphics A Top Down Approach with OpenGL-Edward
Angel,5th Editon, Addison Wesley,2008.
** OpenGL programming guide. The official guide to learning OpenGL Version 2.1. 6th
edition (2007).

DEPARTMENT OF CSE 2009 Page 52