100% found this document useful (2 votes)
2K views35 pages

Air Traffic Project

This document provides details about an air traffic control simulation project implemented in OpenGL. It includes: 1) An abstract that outlines the main goals of simulating air traffic control concepts and preventing collisions using separation rules. 2) Details of the system specifications including software requirements of OpenGL and operating systems as well as hardware requirements. 3) An introduction to OpenGL that explains the basics of how it renders 3D objects through a processing pipeline. 4) An overview of the key OpenGL functions used to implement the simulation including drawing objects, setting colors, and handling user input.

Uploaded by

Wasim Shariff
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
100% found this document useful (2 votes)
2K views35 pages

Air Traffic Project

This document provides details about an air traffic control simulation project implemented in OpenGL. It includes: 1) An abstract that outlines the main goals of simulating air traffic control concepts and preventing collisions using separation rules. 2) Details of the system specifications including software requirements of OpenGL and operating systems as well as hardware requirements. 3) An introduction to OpenGL that explains the basics of how it renders 3D objects through a processing pipeline. 4) An overview of the key OpenGL functions used to implement the simulation including drawing objects, setting colors, and handling user input.

Uploaded by

Wasim Shariff
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 35

Air Traffic Control

SL.NO particulars PAGE.NO


1 Abstract 2
2 System Specifications 3
3 Introduction to OpenGL 4
4 Implementation 7
5 Interaction 9
6 Source Code 10
7 Output 28
8 Conclusion 30
9 Bibliography 31
Contents

1 Dept. of Computer Science & Engineering.


Air Traffic Control

Abstract

⮚ Main aim of this Mini Project is to illustrate the concepts and usage of Air
Traffic Control in OpenGL.
⮚ Air traffic control (ATC) is a service provided by ground-based
controllers who direct aircraft on the ground and through controlled
airspace.
⮚ The primary purpose of ATC systems worldwide is to prevent collisions,
organize and expedite the flow of traffic, and provide information and other
support for pilots

⮚ To prevent collisions, ATC enforces traffic separation rules, which ensure


each aircraft maintains a minimum amount of empty space around it at all
times.
● We have used input devices like mouse and key board to interact with
program.
⮚ We have used input devices like mouse and key board to interact with
program.
⮚ We have added menu which makes the program more interactive.

2 Dept. of Computer Science & Engineering.


Air Traffic Control

System specifications

⮚ SOFTWARE REQUIREMENTS :

▪ MICROSOFT VISUAL C++

▪ OPENGL

⮚ OPERATING SYSTEM :

▪ WINDOWS 2007, WINDOWS XP.

⮚ HARDWARE REQUIREMENT :

▪ GRAPHICS SYSTEM.
▪ Pentium P4 with 256 of Ram(Min).

3 Dept. of Computer Science & Engineering.


Air Traffic Control

Introduction to OpenGL

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 or pixels.
OpenGL performs several processing steps on this data to convert it to pixels to form
the final desired image in the frame buffer.

OpenGL Fundamentals
This section explains some of the concepts inherent in OpenGL.

Primitives and Commands


OpenGL draws primitives—points, line segments, or polygons—subject to several
selectable modes.
You can control modes independently of each other; that is, setting one mode doesn't
affect whether other modes are set .Primitives are specified, modes are set, and other
OpenGL operations are described by issuing commands in the form of function calls.
Primitives are defined by a group of one or more vertices. A vertex defines a point,
an endpoint of a line, or a corner of a polygon where two edges meet. Data is
associated with a vertex, and each vertex and its associated data are processed
independently, in order, and in the same way. The type of clipping depends on which
primitive the group of vertices represents.
Commands are always processed in the order in which they are received, although
there may be an indeterminate delay before a command takes effect. This means that
each primitive is drawn completely before any subsequent command takes effect. It
also means that state-querying commands return data that's consistent with complete
execution of all previously issued OpenGL commands.

4 Dept. of Computer Science & Engineering.


Air Traffic Control

Basic OpenGL Operation


The figure shown below gives an abstract, high-level block diagram of how OpenGL
processes data. In the diagram, commands enter from the left and proceed through
what can be thought of as a processing pipeline. Some commands specify geometric
objects to be drawn, and others control how the objects are handled during the
various processing stages.
Figure . OpenGL Block Diagram

As shown by the first block in the diagram, rather than having all commands
proceeds immediately through the pipeline, you can choose to accumulate some of
them in a display list for processing at a later time.

Rasterization produces a series of frame buffer addresses and associated values using
a two-dimensional description of a point, line segment, or polygon.

5 Dept. of Computer Science & Engineering.


Air Traffic Control

Each fragment so produced is fed into the last stage,


Per-Fragment operations, which performs the final operations on the data before it's
stored as pixels in the frame buffer. These operations include conditional updates to
the frame buffer based on incoming and previously stored z-value s (for z-buffering)
and blending of incoming pixel colors with stored colors, as well as masking and
other logical operations on pixel values.
All elements of OpenGL state, including the contents of the texture memory and
even of the frame buffer, can be obtained by an OpenGL application.

6 Dept. of Computer Science & Engineering.


Air Traffic Control

Implementation

This program is implemented using various OpenGL functions which are


shown below.

Various functions used in this program.


⮚ glutInit() : interaction between the windowing system and OPENGL is
initiated
⮚ glutInitDisplayMode() : used when double buffering is required and depth

information is required

⮚ glutCreateWindow() : this opens the OPENGL window and displays the title

at top of the window

⮚ glutInitWindowSize() : specifies the size of the window

⮚ glutInitWindowPosition() : specifies the position of the window in screen

co-ordinates

⮚ glutKeyboardFunc() : handles normal ASCII symbols

⮚ glutSpecialFunc() : handles special keyboard keys

7 Dept. of Computer Science & Engineering.


Air Traffic Control

⮚ glutReshapeFunc() : sets up the callback function for reshaping the window

⮚ glutIdleFunc() : this handles the processing of the background

⮚ glutDisplayFunc() : this handles redrawing of the window

⮚ glutMainLoop() : this starts the main loop, it never returns

⮚ glViewport() : used to set up the viewport

⮚ glVertex3fv() : used to set up the points or vertices in three dimensions

⮚ glColor3fv() : used to render color to faces

⮚ glFlush() : used to flush the pipeline

⮚ glutPostRedisplay() : used to trigger an automatic redrawal of the object

⮚ glMatrixMode() : used to set up the required mode of the matrix

⮚ glLoadIdentity() : used to load or initialize to the identity matrix

⮚ glTranslatef() : used to translate or move the rotation centre from one point

to another in three dimensions

⮚ glRotatef() : used to rotate an object through a specified rotation angle

8 Dept. of Computer Science & Engineering.


Air Traffic Control

Interaction with program

⮚ We can have an interaction with this project using popular input device like
mouse and key board are used to interact with this program.

⮚ Some keys of key board have specific function, we mentioned them below,

▪ ‘a’ – add new plane

▪ ‘r’ – to remove plane

▪ ‘t’ – take off

▪ ‘q’– quit

⮚ With these above mentioned keys, we can interact with the program.

⮚ Also we can interact with this program by using mouse (input device),

By right and left mouse button

● On right click of mouse menu will occur.

● Select the option by left click of mouse.

9 Dept. of Computer Science & Engineering.


Air Traffic Control

Source Code

/*An Interactive Program to create 3d objects*/

#include <windows.h>
#include<string.h>
#include<stdarg.h>
#include<stdio.h>
#include <glut.h>
static double x[10]={0},x2=0.0,r1=0.0;
static double yaxis[10]={-15,-15,-15,-15,-15,-15,-15,-15,-15,-15};
static double max=0;
static bool takeOff=false;

void
stroke_output(GLfloat x, GLfloat y, char *format,...)
{
va_list args;

10 Dept. of Computer Science & Engineering.


Air Traffic Control

char buffer[200], *p;


va_start(args, format);
vsprintf(buffer, format, args);
va_end(args);
glPushMatrix();
glTranslatef(-2.5, y, 0);
glScaled(0.003, 0.005, 0.005);
for (p = buffer; *p; p++)
glutStrokeCharacter(GLUT_STROKE_ROMAN, *p);
glPopMatrix();
}

//runway strip
void strip(float x1)
{
glPushMatrix();
glRotatef(-65,0,1,0);
glColor3f(1,1,1);
glTranslatef(x1,-3.5,7.8);
glScaled(1,0.15,0.1);
glutSolidCube(1);
glPopMatrix();
}

void drawPlane(float y1){

/*********** PLANE CONSTRUCTION *******************/

11 Dept. of Computer Science & Engineering.


Air Traffic Control

glPushMatrix();

// Main Body
glPushMatrix();
glScalef(.3,0.3,1.5);
if(y1<=15)
glColor3f(1,1.0,0.5);
if(y1>=15)
glColor3f(1,0.3,0.5);

glutSolidSphere(2.0,50,50);
glPopMatrix();

glPushMatrix();
glTranslatef(0.0,0.1,-1.8);
glScalef(1.0,1,1.5);
glColor3f(0,0,1);
glutSolidSphere(0.5,25,25);
glPopMatrix();

//Left Fin

glPushMatrix();
glTranslatef(-1.0,0,0);
glScalef(1.5,0.1,0.5);
glColor3f(0,0,0);
glutSolidSphere(1.0,50,50);
glPopMatrix();

// Right Fin

12 Dept. of Computer Science & Engineering.


Air Traffic Control

glPushMatrix();

glTranslatef(1.0,0,0);
glScalef(1.5,0.1,0.5);
glColor3f(0,0,0);
glutSolidSphere(1.0,50,50);
glPopMatrix();

//right Tail fin


glPushMatrix();

glTranslatef(0.8,0,2.4);
glScalef(1.2,0.1,0.5);
glColor3f(0.0,0,0);
glutSolidSphere(0.4,50,50);
glPopMatrix();

//left Tail fin


glPushMatrix();
glTranslatef(-0.8,0,2.4);
glScalef(1.2,0.1,0.5);
glColor3f(0.0,0,0);
glutSolidSphere(0.4,50,50);
glPopMatrix();

//Top tail fin


glPushMatrix();
glTranslatef(0,0.5,2.4);
glScalef(0.1,1.1,0.5);
glColor3f(0.0,0,0);
glutSolidSphere(0.4,50,50);
glPopMatrix();

13 Dept. of Computer Science & Engineering.


Air Traffic Control

// Blades
glPushMatrix();
glRotatef(x2,0.0,0.0,1.0);
glPushMatrix();
glTranslatef(0,0.0,-3.0);
glScalef(1.5,0.2,0.1);
glColor3f(0.0,0,0);
glutSolidSphere(0.3,50,50);
glPopMatrix();

//blades
glPushMatrix();
glRotatef(90,0.0,0.0,1.0);
glTranslatef(0,0.0,-3.0);
glScalef(1.5,0.2,0.1);
glColor3f(0.0,0,0);
glutSolidSphere(0.3,50,50);
glPopMatrix();

glPopMatrix();
/* Blased End */

/* Wheels */
//Front

glPushMatrix();
glTranslatef(0.0,-0.8,-1.5);
glRotatef(90,0.0,1,0);
glScaled(0.3,0.3,0.3);
glutSolidTorus(0.18,0.5,25,25);

14 Dept. of Computer Science & Engineering.


Air Traffic Control

glColor3f(1,1,1);
glutSolidTorus(0.2,0.1,25,25);

glPopMatrix();

glPushMatrix();
glTranslatef(0.0,-0.4,-1.5);
glRotatef(20,0.0,1,0);
glScaled(0.05,0.3,0.05);
glutSolidSphere(1.0,25,25);
glPopMatrix();

//Rear

glPushMatrix();
glTranslatef(0.3,-0.8,0.7);
glRotatef(90,0.0,1,0);
glScaled(0.3,0.3,0.3);
glColor3f(0,0,0);
glutSolidTorus(0.18,0.5,25,25);
glColor3f(1,1,1);
glutSolidTorus(0.2,0.1,25,25);
glPopMatrix();

glPushMatrix();
glTranslatef(0.3,-0.4,0.7);
glRotatef(20,0.0,1,0);
glScaled(0.05,0.3,0.05);
glutSolidSphere(1.0,25,25);
glPopMatrix();

15 Dept. of Computer Science & Engineering.


Air Traffic Control

//rear 2
glPushMatrix();
glTranslatef(-0.3,-0.8,0.7);
glRotatef(90,0.0,1,0);
glScaled(0.3,0.3,0.3);
glColor3f(0,0,0);
glutSolidTorus(0.18,0.5,25,25);
glColor3f(1,1,1);
glutSolidTorus(0.2,0.1,25,25);
glPopMatrix();

glPushMatrix();
glTranslatef(-0.3,-0.4,0.7);
glRotatef(20,0.0,1,0);
glScaled(0.05,0.3,0.05);
glutSolidSphere(1.0,25,25);
glPopMatrix();

glPopMatrix();

void animate(float y1,float x1){

// Plane Transition
glPushMatrix();

16 Dept. of Computer Science & Engineering.


Air Traffic Control

//Move the Plane towards rotating zone


if(y1<=-2){
glTranslatef(5.5+y1,3,0);
glRotatef(-90,0,1,0);
}

// Move the Plane towards 2nd runwat


if(takeOff)
if(y1>=15){
glRotatef(140,0,1,0);

if(y1>=15 && y1<=20)


glTranslatef(2+15-y1,-3,-3);

if(y1>=20)
glTranslatef(2+15-y1,-3-20+y1,-3);

// keep rotating the plane


if(y1>=-2 && y1<=2){
glTranslatef(3.0,3.0,0.0);
}
//Start desending the plane
if(y1>=2 && y1<=6.5)
{
glTranslatef(3,3-y1+2,0);
}
// move towards runway
if(y1>=6.5 && y1<=8.2)
{

17 Dept. of Computer Science & Engineering.


Air Traffic Control

glTranslatef(3-y1+6.5,3-y1+2,0);
}
// landing only change the x-axis
if(y1>=8.2 && y1<=15)
{
glTranslatef(3-y1+6.5,3-8.2+2,0);
}

// Rotate the plane about its own axiz w.r.t y-axis.


if(y1>=-2)
glRotatef(x1,0,1,0);

glPushMatrix();
//Move the plane away from its axis
glTranslatef(1,0,0);

glScaled(0.3,0.3,0.15);
//tilt the plane until its being rotated
if(y1<=8.2)

if(yaxis[0]>=-2)
glRotatef(15,0,0,1);

if(y1<=15){
drawPlane(y1);
}

if(y1>=15 && takeOff){

drawPlane(y1);
}

18 Dept. of Computer Science & Engineering.


Air Traffic Control

glPopMatrix();

glPopMatrix();

void airport(){

//Floor
glColor3f(0,1,0);
glBegin(GL_POLYGON);
glVertex3f(-19,-3.5,19);
glVertex3f(-19,-3.5,-19);
glVertex3f(19,-3.5,-19);
glVertex3f(19,-3.5,19);
glEnd();

glPushMatrix();

// runway landing

glPushMatrix();
glColor3f(1,1,1);
glTranslatef(0,-3.5,-1);
glScaled(17,0.1,1);
glutSolidCube(1);
glPopMatrix();

19 Dept. of Computer Science & Engineering.


Air Traffic Control

// runway takeoff

glPushMatrix();
glColor3f(1,1,1);
glTranslatef(-0.5,-3.5,4);
glRotatef(-60,0,1,0);
glScaled(11,0.1,1);
glutSolidCube(1);
glPopMatrix();

// runway + parking

glPushMatrix();
glRotatef(-65,0,1,0);
glColor3f(0.1,0.1,0.1);
glTranslatef(3,-3.5,7.8);
glScaled(15.5,0.1,1);
glutSolidCube(1);
glPopMatrix();

//parking place 1
glPushMatrix();
glRotatef(-65,0,1,0);
glColor3f(0.1,0.1,0.1);
glTranslatef(-1,-3.5,7);
glScaled(2.5,0.1,1.5);
glutSolidCube(1);
glPopMatrix();

//parking plane 1
glPushMatrix();
glRotatef(-65,0,1,0);

20 Dept. of Computer Science & Engineering.


Air Traffic Control

glTranslatef(3,-2.7,7.4);
glScaled(0.15,0.3,0.15);
drawPlane(16);
glPopMatrix();

//parking place 2
glPushMatrix();
glRotatef(-65,0,1,0);
glColor3f(0.1,0.1,0.1);
glTranslatef(3,-3.5,7);
glScaled(2.5,0.1,1.5);
glutSolidCube(1);
glPopMatrix();

//parking plane 2
glPushMatrix();
glRotatef(-65,0,1,0);
glTranslatef(6.5,-2.7,7.4);
glScaled(0.15,0.3,0.15);
drawPlane(16);
glPopMatrix();

//parking place 3
glPushMatrix();
glRotatef(-65,0,1,0);
glColor3f(0.1,0.1,0.1);
glTranslatef(7,-3.5,7);
glScaled(2,0.1,1.5);
glutSolidCube(1);
glPopMatrix();

//parking plane 3

21 Dept. of Computer Science & Engineering.


Air Traffic Control

glPushMatrix();
glRotatef(-65,0,1,0);
glTranslatef(10,-2.7,7.4);
glScaled(0.15,0.3,0.15);
drawPlane(16);
glPopMatrix();

// parking building

glPushMatrix();
glRotatef(-65,0,1,0);
glColor3f(0,0.5,0.5);
glTranslatef(4,-3.5,5.5);
glScaled(14,2.2,1);
glutSolidCube(1);

glPushMatrix();
//glRotatef(15,0,1,0);
glTranslatef(0,0.3,0);
glScaled(0.9,0.3,1);
glColor3f(0.1,0.1,0.1);
glutSolidCube(1);
glPopMatrix();

glPopMatrix();

strip(-2);
strip(0);
strip(2);

22 Dept. of Computer Science & Engineering.


Air Traffic Control

strip(4);
strip(6);
strip(8);
strip(10);

// runway Lights
for(float j=-1.3;j<=-0.5;j+=0.8)
{
for(float i=-4.5;i<=1.8;i+=0.9){

glPushMatrix();
glColor3f(1,0,0);
glTranslatef(i,-3.4,j);
//glScaled(6,0.2,1);
glutSolidSphere(0.05,10,10);
glPopMatrix();
}}

glTranslatef(7,0,-4);
// Building
glPushMatrix();
glTranslatef(-2,-3,-2);
glutSolidCube(1);
glPopMatrix();

//Rotating Dish
glPushMatrix();
glColor3f(0,0,1);
glTranslatef(-2,-2.0,-2);
glRotatef(x2/15,0,1,0);

23 Dept. of Computer Science & Engineering.


Air Traffic Control

glScaled(0.1,0.3,1);
glutSolidCube(1);
glPopMatrix();
//dish connector
glPushMatrix();
glColor3f(0,0,1);
glTranslatef(-2,-2.5,-2);
glScaled(0.1,0.9,0.1);
glutSolidCube(1);
glPopMatrix();

glPopMatrix();
//Mountain
glPushMatrix();
glColor3f(0.2,0.2,0.2);
glTranslatef(-3,-3,-15);
glScaled(10,4,1);
glutSolidDodecahedron();
glPopMatrix();

// Start your Drawing ---Draw pyramid

void controller()
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glLoadIdentity();
glTranslatef(0.0,0.0,-25.0);

24 Dept. of Computer Science & Engineering.


Air Traffic Control

//q glRotatef(-90,0,1,0);

animate(yaxis[0],x[0]);

for(int i=0;i<max;i++){
if(yaxis[i]>=-5){ //wait until previous plane reaches safe location
animate(yaxis[i+1],x[i+1]);
if(yaxis[i+1]>=-2 && yaxis[i+1]<=6.7)
// Rotate until y-axis of plane is less than 6.7
x[i+1]+=3.5;

// Conditions to increase or decrease the speed of plane


if(yaxis[i+1]<=0)
yaxis[i+1]+=0.15;

else if(yaxis[i+1]>=0 && yaxis[i+1]<=6.7)

yaxis[i+1]+=0.06;

else if(yaxis[i+1]>=6.7 && yaxis[i+1]<=15)

yaxis[i+1]+=0.1;

else if(takeOff && yaxis[i+1]<=30)

yaxis[i+1]+=0.1;

25 Dept. of Computer Science & Engineering.


Air Traffic Control

airport();

x2+=15.0; // Rotate the plane blades

// Increments of First plane

if(yaxis[0]>=-2 && yaxis[0]<=6.7)

x[0]+=3.5; // used to rotate the plane

//Translate the plane

// Conditions to increase or decrease the speed of first plane


if(yaxis[0]<=0)

yaxis[0]+=0.15;

else if(yaxis[0]>=0 && yaxis[0]<=6.7)

yaxis[0]+=0.06;

else if(yaxis[0]>=6.7 )

yaxis[0]+=0.1;

26 Dept. of Computer Science & Engineering.


Air Traffic Control

glFlush();
glutSwapBuffers();

void doInit()
{

/* Background and foreground color */


glClearColor(1.0,1.0,1.0,0.0);

glViewport(0,0,640,480);

/* Select the projection matrix and reset it then


setup our view perspective */

glMatrixMode(GL_PROJECTION);
glLoadIdentity();

gluPerspective(30.0f,(GLfloat)640/(GLfloat)480,0.1f,200.0f);

/* Select the modelview matrix, which we alter with rotatef() */


glMatrixMode(GL_MODELVIEW);

glLoadIdentity();
glClearDepth(2.0f);
glEnable(GL_DEPTH_TEST);
glDepthFunc(GL_LEQUAL);

27 Dept. of Computer Science & Engineering.


Air Traffic Control

glEnable(GL_COLOR_MATERIAL);
}

void display()
{

glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

glLoadIdentity();
glTranslatef(0.0f,0.0f,-13.0f);

stroke_output(-2.0, 1.7, "p--> Pyramid Clockwise");


stroke_output(-2.0, 1.0, "P--> Pyramid Anti Clockwise");
stroke_output(-2.0, 0.3, "h--> House Clockwise");
stroke_output(-2.0, -0.4, "H--> House Anti-Clockwise");
stroke_output(-2.0, -1.1, "q--> quit");

GLfloat mat_ambient[]={0.0f,1.0f,2.0f,1.0f};
GLfloat mat_diffuse[]={0.0f,1.5f,.5f,1.0f};
GLfloat mat_specular[]={5.0f,1.0f,1.0f,1.0f};
GLfloat mat_shininess[]={50.0f};

glMaterialfv(GL_FRONT,GL_AMBIENT,mat_ambient);
glMaterialfv(GL_FRONT,GL_DIFFUSE,mat_diffuse);
glMaterialfv(GL_FRONT,GL_SPECULAR,mat_specular);
glMaterialfv(GL_FRONT,GL_SHININESS,mat_shininess);

GLfloat lightIntensity[]={3.7f,0.7f,0.7f,1.0f};

GLfloat light_position[]={0.0f,3.0f,2.0f,0.0f};

28 Dept. of Computer Science & Engineering.


Air Traffic Control

glLightfv(GL_LIGHT0,GL_POSITION,light_position);
glLightfv(GL_LIGHT0,GL_DIFFUSE,lightIntensity);

glutIdleFunc(controller);

glFlush();
glutSwapBuffers();

void menu(int id)


{
switch(id)
{
case 1:max+=1;
break;

case 2:max-=1;
break;

case 3:takeOff=!takeOff;
break;

case 4:exit(0);
break;

}
glFlush();
glutSwapBuffers();
glutPostRedisplay();

29 Dept. of Computer Science & Engineering.


Air Traffic Control

void mykey(unsigned char key,int x,int y)


{

if(key=='p')
{
glutIdleFunc(controller);
}

if(key=='f')
{
takeOff=!takeOff;
}

if(key=='a')

{
max+=1;
}

if(key=='r')

{
max-=1;
}

if(key=='q'|| key=='Q')

30 Dept. of Computer Science & Engineering.


Air Traffic Control

{
exit(0);
}

int main(int argc, char *argv[])


{
glutInit(&argc, argv);

glutInitDisplayMode(GLUT_DOUBLE|GLUT_RGB);

glutInitWindowSize(1000,480);
glutInitWindowPosition(100,100);
glutCreateWindow("Glut Plane");

glutDisplayFunc(display);

glEnable(GL_LIGHTING);
glEnable(GL_LIGHT0);
glShadeModel(GL_SMOOTH);
glEnable(GL_DEPTH_TEST);
glEnable(GL_NORMALIZE);

glutKeyboardFunc(mykey);

glutCreateMenu(menu);

glutAddMenuEntry("Add Plane 'a'",1);


glutAddMenuEntry("Remove 'r'",2);
glutAddMenuEntry("Takeoff 'f'",3);

31 Dept. of Computer Science & Engineering.


Air Traffic Control

glutAddMenuEntry("Quit 'q'",4);
glutAttachMenu(GLUT_LEFT_BUTTON);
glutAttachMenu(GLUT_RIGHT_BUTT ON);

doInit();

glutMainLoop();
return 0;
}

32 Dept. of Computer Science & Engineering.


Air Traffic Control

OUTPUT OF THE PROGRAM

33 Dept. of Computer Science & Engineering.


Air Traffic Control

Conclusions

This project aims at using glut pre-built model sub-api and callback functions.

Finally we conclude that this program clearly illustrate the use of glut model sub-
api. and has been completed successfully and is ready to be demonstrated.

34 Dept. of Computer Science & Engineering.


Air Traffic Control

Bibliography
WE HAVE OBTAINED INFORMATION FROM MANY RESOURCES TO DESIGN AND
IMPLEMENT OUR PROJECT SUCCESSIVELY. WE HAVE ACQUIRED MOST OF THE
KNOWLEDGE FROM RELATED WEBSITES. THE FOLLOWING ARE SOME OF THE
RESOURCES :

⮚ TEXT BOOKS :
INTERACTIVE COMPUTER GRAPHICS A TOP-DOWN APPROACH
-By Edward Angel.

⮚ COMPUTER GRAPHICS,PRINCIPLES & PRACTICES

- Foley van dam

- Feiner hughes

⮚ WEB REFERENCES:
http://jerome.jouvie.free.fr/OpenGl/Lessons/Lesson3.php
http://google.com
http://opengl.org

35 Dept. of Computer Science & Engineering.

You might also like