ATC (Project) Final 11

Download as pdf or txt
Download as pdf or txt
You are on page 1of 42

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 added menu which makes the
program more interactive.

ii
CONTENTS

TITLE PAGES

ACKNOWLEDGEMENT i

ABSTRACT ii

CONTENTS iii

LIST OF FIGURES iv

CHAPTER 1 INTRODUCTION 1-3


1.1 COMPUTER GRAPHICS 2

CHAPTER 2 LITERATURE SURVEY 4-7


2.1 OPENGL TECHNOLOGY 4
2.2 OPENGL FUNDAMENTALS 5
2.3 PROJECT DEFINITION 6

CHAPTER 3 SYSTEM REQUIRMENT SPECIFICATION 7

CHAPTER 4 DESIGN 8-9


4.1 SYSTEM DESIGN 9

CHAPTER 5 IMPLEMENTATION 10-45


5.1 VISUAL STUDIO 10
5.2 OPENGL FUNCTIONS 11-12
5.3 SOURCE CODE 13-34

CHAPTER 6 SNAPSHOTS 35-36

CHAPTER 7 CONCULSION 37

CHAPTER 8 REFERENCES 38

iii
LIST OF FIGURES

Figure No. Figure Name Page No.

Fig 1.1 Graphics System 2


Fig 2.1 Graphics Pipeline 5

Fig 6.1 Homepage 36


Fig 6.2 Adding planes 36

Fig 6.3 Flowchart 37

Fig 6.4 Deleting planes 38

iv
AIR TRAFFIC CONTROL 2023-24

CHAPTER 1
INTRODUCTION

Computer graphics is concerned with all aspects of producing picture or an image


using computers and, more generally, the representation and manipulation of pictorial
data by a computer. The development of computer graphics has made computers easier
to interact with and better for understanding and interpreting many types of data.
Developments in computer graphic had a profound impact on many types of media
and have revolutionized the animation and video game industry. Today computers and
computer-generated images touch many aspects of our daily life. Computer imagery is
found on television, in newspapers, in weather reports, and during surgical procedures.
A well-constructed graph can present complex statistics in a form that is easier to
understand and interpret. Such graphs are used to illustrate papers, reports, theses, and
other presentation material. A range of tools and facilities are available to enable users
to visualize their data, and computer graphics are used in many disciplines. We
implement computer graphics using the OpenGL API. OpenGL (Open Graphics
Library) is a standard specification defining a cross-language, cross-platform API for
writing applications that produce 2D and 3D computer graphics.
OpenGL is a low-level graphics library specification. It makes available to the
programmer a small set of geometric primitives - points, lines, polygons, images, and
bitmaps. OpenGL provides a set of commands that allow the specification of geometric
objects in two or three dimensions, using the provided primitives, together with
commands that control how these objects are rendered (drawn). Since OpenGL
drawing commands are limited to those that generate simple geometric primitives
(points, lines, and polygons), the OpenGL Utility Toolkit (GLUT) has been created to
aid in the development of more complicated three-dimensional objects such as a
sphere, a torus, and even teapot. GLUT may not be satisfactory for full- featured
OpenGL applications, but it is a useful starting point for learning OpenGL. GLUT is
designed to fill the need for a window system independent programming

Dept. Of CSE, BGSIT, B G NAGARA Page 1


AIR TRAFFIC CONTROL 2023-24

interface for OpenGL programs. The interface is designed to be simple yet still meet the
needs of useful OpenGL programs. Removing window system operations from OpenGL
is a sound decision because it allows the OpenGL graphics system to be retargeted to
various Systems including powerful but expensive graphics workstations as well as mass-
production graphics systems like video games, set-top boxes for interactive television,
and PCs.

The GLUT application-programming interface (API) requires very few routines to display a
graphics scene rendered using OpenGL. The GLUT routines also take relatively few parameters.

1.1 COMPUTER GRAPHICS

The term computer graphics includes almost everything on computers that is not text or
sound. Today nearly all computers use some graphics and users expect to control their
computer through icons and pictures rather than just by typing. The term Computer
Graphics has several meanings The representation

Fig 1.1 A Graphics System

and manipulation of pictorial data by a computer. The various technologies used to create
and manipulate such pictorial data The images so produced, and The sub-field of
computer science which studies methods for digitally synthesizing and manipulating
visual content Today computers and computer- generated images touch many aspects of
our daily life.

Dept. Of CSE, BGSIT, B G NAGARA Page 2


AIR TRAFFIC CONTROL 2023-24

Computer imagery is found on television, in newspapers, in weather reports, and during


surgical procedures. A well-constructed graph can present complex statistics in a form
that is easier to understand and interpretation fig 1.1 inputs go to processor from there
to frame buffer and then it displays the pixel. It illustrates the graphics system. A
graphics system is just the graphics part of the software. that sits in between the hardware
and application programs.

Computer graphics encompasses a wide range of applications and techniques, including:

1. 2D and 3D Graphics: Computer graphics can be used to create two-dimensional (2D)


images and three-dimensional (3D) models of objects or scenes. These can be static
images or dynamic animations.

2. Rendering: Rendering refers to the process of generating realistic images from 3D


models or scenes. It involves simulating the behavior of light, shadows, materials, and
other visual properties to create visually appealing and accurate representations.

3. Animation: Computer graphics is heavily used in animation, which involves creating


the illusion of motion by displaying a sequence of images in rapid succession. This can
range from traditional hand-drawn animation to sophisticated computer-generated
animation in movies, video games, and other digital media.

4. Virtual Reality (VR) and Augmented Reality (AR): Computer graphics plays a vital
role in VR and AR technologies, which immerse users in virtual worlds or overlay
virtual objects onto the real world. Realistic graphics and real-time rendering are crucial
for creating convincing and immersive experiences.

5. Image Processing and Manipulation: Computer graphics techniques are employed in


image processing and manipulation tasks, such as image editing, enhancement,
restoration, and compression.

Dept. Of CSE, BGSIT, B G NAGARA Page 3


AIR TRAFFIC CONTROL 2023-24

CHAPTER 2

LITERATURE SURVEY

2.1 OPENGL TECHNOLOGY

OpenGL is strictly defined as “a software interface to graphics hardware.” In


essence, it is a 3D graphics and modelling library that is highly portable and very fast.
Using OpenGL, you can create elegant and beautiful 3D graphics with exceptional visual
quality. The greatest advantage to using OpenGL is that it is orders of magnitude faster
than a ray tracer or software- rendering engine. Initially, it used algorithms carefully
developed and optimized by Silicon Graphics, Inc. (SGI), an acknowledged world leader
in computer graphics and animation.
Vertex processing: Much of the work in the pipeline is in converting object
representations from one co-ordinate system to another. Every vertex is processed
independently.
The co-ordinate system include the following:
Object co-ordinates, Camera co-ordinates, Screen co-ordinates.
Clipping and Primitive assembly: clipping is necessary, because of the
that no imagining system can see the whole object at once. Cameras have film of limited
size. Image outside the clipping volume is clipped out. Clipping is done by vertex basis.
Rasterization: generation of pixels in the frame buffer. Rasterizer determines which
pixels in the frame buffer are inside the polygon. The output of the Rasterizer isa set of
fragments for each primitive. Fragments carry color, location, depth and other
information.
Fragment processing: Updates the pixel in the frame buffer. Color of the pixels that
correspond to fragment can be read from the frame buffer. Color fragment may be altered
by texture mapping.

Dept. Of CSE, BGSIT, B G NAGARA Page 4


AIR TRAFFIC CONTROL 2023-24

Fig 2.1 Graphics pipeline.

A computer graphics pipeline, rendering pipeline, is a conceptual model that describes


what steps a graphics system needs to perform to render a 3D scene to a 2D screen. The
graphics pipeline as four stages. These stages include vertex processing, clipping,
rasterization .
2.2 OPENGL FUNDAMENTALS
The 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 (although many modes may
interact to determine what eventually ends up in the frame buffer). 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 (consisting of vertex coordinates, colors, normal, texture
coordinates, and edge flags) is associated with a vertex, and each vertex and its associated
data are processed independently, in order, and in the same way. The only exception to
this rule is if the group of vertices must be clipped so that a particular primitive fits within
a specified region; in this case, vertex data may be modified and new vertices created.
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 meansthat each
primitive is drawn completely before any subsequent command takes effect. Italso means
that state- querying commands return data that's consistent with complete

Dept. Of CSE, BGSIT, B G NAGARA Page 5


AIR TRAFFIC CONTROL 2023-24

execution of all previously issued OpenGL commands. Construct shapes from geometric
primitives, thereby creating mathematical descriptions of objects. (OpenGL considers
points, lines, polygons, images, and bitmaps to be primitives.) Arrange the objects in
three-dimensional space and select the desired vantage point for viewing the composed
scene. Calculate the color of all the objects. The color might be explicitly assigned by the
application, determined from specified lighting conditions, obtained by pasting texture
onto the objects, or some combination of these three actions. Convert the mathematical
description of objects and their associated color information to pixels on the screen. This
process is called rasterization. OpenGL is a standard specification that defines an API that
is multi-language and multi-platform and that enables the codificationof applications that
output computerized graphics in 2D and 3 The interface consists inmore than 250
different functions, which can be used to draw complex tridimensional scenes with
simple primitives. It consists of many functions that help to create a real-world object
and a particular existence for an object can be given.

2.3 PROJECT DEFINITION

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
worldwide is to prevent collisions, organize and expedite the flow of air traffic, and
provide information and other support for pilots. Air traffic controllers monitor the
location of aircraft in their assigned airspace by radar and communicate with the pilots
by radio. To prevent collisions, ATC enforces traffic separation rules, which ensure each
aircraft maintains a minimum amount of empty space around it at all times. It is also
common for ATC to provide services to all private, military, and commercial aircraft
operating within its airspace, not just civilian aircraft. Depending on the type of flight
and the class of airspace, ATC may issues instructions that pilots are required to obey, or
advisories that pilots may, at their discretion, disregard. The pilot in command is the
finally authority for the safe operation of the aircraft and may, in an emergency, deviate
from ATC instructions to extent required to maintain safe operation of their aircraft.

Dept. Of CSE, BGSIT, B G NAGARA Page 6


AIR TRAFFIC CONTROL 2023-24

CHAPTER 3

SYSTEM REQUIREMENTS SPECIFICATION

3.1 Minimum hardware requirements

• Microprocessor: 1.0 GHz and above CPU based on either


AMD or INTEL Microprocessor architecture.

• Main memory: 512 MB RAM.

• Hard Disk : 100MB.

• Hard disk speed in RPM: 5400 RPM.

• Keyboard: QWERTY Keyboard.

• Mouse: Standard serial mouse.

• Monitor: 1024 x 768 display resolution.

3.2 Minimum software requirements

• Operating system: Windows XP and later.

• Visual C++ 2005 and later.

• Microsoft Visual Studio 2010

• Header files:

1. GL/glut.h

2. stdio.h

3. math.h

Dept. Of CSE, BGSIT, B G NAGARA Page 7


AIR TRAFFIC CONTROL 2023-24

CHAPTER 4
DESIGN

4.1 SYSTEM DESIGN

The mini project is designed to how graphics can be used to represent data. It isa
graphics package encoded in Microsoft Visual C++ with OpenGL and the mini
project basically deals with providing the graphical representation of data that a user
provides as statistics to the system.

The above mini project can be analyzed as follows:

• The mini project is implemented using ‘C++’ and ‘OpenGL’ built in functions.

• In the beginning the user is asked to enter the statistical data through the windows
command line.

• Once the data is input, the computations are done by program to compute various
co- ordinates etc. and appropriate graph as per users choice is rendered on the display
window.

• This project is developed using Microsoft Visual C++ with OpenGL as an


academic project using keyboard and mouse. This project is implemented by making
use of extensive use of library functions offered by graphic package of ‘OpenGL’. A
list of standard library functions that are used are given below. A number of user
defined functions also have been used and a summary of those functions follows this
list of standard library functions.

• The aim of the project is to show how the a space shooter can be implemented
using computer graphics. The various functions used to implement it are attractive.

Dept. Of CSE, BGSIT, B G NAGARA Page 8


AIR TRAFFIC CONTROL 2023-24

Fig 4.1 DataFlow Diagram.

The dataflow diagram. Which shows the flow of data within the program from the start
to the different functions within the program, where each function will perform its
specified actions for the proper display of the graphics and functionality defined within
the program.

Dept. Of CSE, BGSIT, B G NAGARA Page 9


AIR TRAFFIC CONTROL 2023-24

CHAPTER 5
IMPLEMENTATION

5.1 INTRODUCTION TO VISUAL STUDIO

Microsoft Visual Studio is an integrated development environment (IDE) from


Microsoft. It is used to develop computer programs for Microsoft Windows super
family of operating systems, as well as websites, web applications and web services.
Visual Studio uses Microsoft software development platforms such as Windows API,
Windows Forms, Windows Presentation Foundation, Windows Store and Microsoft
Silverlight. It can produce both native code and managed code.
Visual Studio includes a code editor supporting IntelliSense as well as code
refactoring. The integrated debugger works both as a source- level debugger and a
machine-level debugger. Other built-in tools include a forms designer for building GUI
applications, web designer, class designer, and database schema designer. It accepts
plug-ins that enhance the functionality at almost every level—including addingsupport
for source-control systems (like Subversion ) and adding new toolsets like editors and
visual designers for domain-specific languages or toolsets for other aspects of the
software development lifecycle (like the Team Foundation Server client: Team
Explorer).Visual Studio supports different programming languages and allows the
code editor and debugger to support (to varying degrees) nearly any programming
language, provided a language-specific service exists. Built-in languages include C,
C++ and C++/CLI (via Visual C++), VB.NET (via Visual Basic
.NET), C# (via Visual C#), and F# (as of Visual Studio 2010). Support for other
languages such as M, Python, and Ruby among others is available via language services
installed separately.

Dept. Of CSE, BGSIT, B G NAGARA Page 10


AIR TRAFFIC CONTROL 2023-24

5.2 OPENGL FUNCTIONS


The functions used in the programs are as follows:

• main( ): The control will first enter into this function and in this function
it will create a window and it will initialize the window and then this function
calls display function.

• glutInit() : interaction between the windowing system and OPENGL is


initiated.

• glutInitDisplayMode() : used when double buffering is required and


depthinformation is required.

• glutCreateWindow() : this opens the OPENGL window and displays the


title at topof thewindow

• 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

• glutReshapeFunc() : sets up the callback function for reshaping the


window

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

Dept. Of CSE, BGSIT, B G NAGARA Page 11


AIR TRAFFIC CONTROL 2023-24

• glutDisplayFunc() : this handles redrawing of the window

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

• 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

Dept. Of CSE, BGSIT, B G NAGARA Page 12


AIR TRAFFIC CONTROL 2023-24

5.3 SOURCE CODE

#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;

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();

Dept. Of CSE, BGSIT, B G NAGARA Page 13


AIR TRAFFIC CONTROL 2023-24

/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 *******************/

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,
5 0,50);
glPopMatrix();
glPushMatrix();

Dept. Of CSE, BGSIT, B G NAGARA Page 14


AIR TRAFFIC CONTROL 2023-24

}
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

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();

Dept. Of CSE, BGSIT, B G NAGARA Page 15


AIR TRAFFIC CONTROL 2022-23

//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();

// 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);
Dept. Of CSE, BGSIT, B G NAGARA Page 16
AIR TRAFFIC CONTROL 2023-24

glutSolidSphere(0.3,50,50);
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);
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);

Dept. Of CSE, BGSIT, B G NAGARA Page 17


AIR TRAFFIC CONTROL 2023-24

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();

//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();

Dept. Of CSE, BGSIT, B G NAGARA Page 18


AIR TRAFFIC CONTROL 2023-24

void animate(float y1,float x1){

// Plane Transition

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

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);
}

Dept. Of CSE, BGSIT, B G NAGARA Page 19


AIR TRAFFIC CONTROL 2023-24

//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)
{
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);

Dept. Of CSE, BGSIT, B G NAGARA Page 20


AIR TRAFFIC CONTROL 2023-24

if(y1>=15 && takeOff){

drawPlane(y1);
}

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);
glTranslate(3.5);
glScaled(17);

Dept. Of CSE, BGSIT, B G NAGARA Page 21


AIR TRAFFIC CONTROL 2023-24

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);

glTranslatef(3,-2.7,7.4);

glScaled(0.15,0.3,0.15);

drawPlane(16);

glPopMatrix();

Dept. Of CSE, BGSIT, B G NAGARA Page 22


AIR TRAFFIC CONTROL 2023-24

glRotatef(-65,0,1,0);
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);

Dept. Of CSE, BGSIT, B G NAGARA Page 23


AIR TRAFFIC CONTROL 2023-24

glPopMatrix();

//parking plane 3

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();

Dept. Of CSE, BGSIT, B G NAGARA Page 24


AIR TRAFFIC CONTROL 2023-24

strip(-2);
strip(0);
strip(2);
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();

Dept. Of CSE, BGSIT, B G NAGARA Page 25


AIR TRAFFIC CONTROL 2023-24

//Rotating Dish

glPushMatrix();
glColor3f(0,0,1);
glTranslatef(-2,-2.0,-2);
glRotatef(x2/15,0,1,0);
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();

Dept. Of CSE, BGSIT, B G NAGARA Page 26


AIR TRAFFIC CONTROL 2023-24

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 pyramidvoid

controller()

glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

glLoadIdentity();

glTranslatef(0.0,0.0,-25.0);

glRotatef(-90,0,1,0)’

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

for(int i=0;i<max;i++){

Dept. Of CSE, BGSIT, B G NAGARA Page 27


AIR TRAFFIC CONTROL 2023-24

if(yaxis[i]>=-5){
//wait until previous plane reaches safe locationanimate(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;

airport();

x2+=15.0; // Rotate the plane blades

// Increments of First plane

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

Dept. Of CSE, BGSIT, B G NAGARA Page 28


AIR TRAFFIC CONTROL 2023-24

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

//Translate the plane

// Conditions to increase or decrease the speed of first planeif(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;

glFlush();

glutSwapBuffers();

void doInit()

Dept. Of CSE, BGSIT, B G NAGARA Page 29


AIR TRAFFIC CONTROL 2023-24

/* 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 thensetup 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)
;
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");

Dept. Of CSE, BGSIT, B G NAGARA Page 30


AIR TRAFFIC CONTROL 2023-24

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};

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

glutIdleFunc(controller);

glFlush();
glutSwapBuffers();

void menu(int id)


{
switch(id)

Dept. Of CSE, BGSIT, B G NAGARA Page 31


AIR TRAFFIC CONTROL 2023-24

{
case 1:max+=1;
break;

case 2:max-=1;
break;

case 3:takeOff=!takeOff;
break;

case 4:exit(0);
break;

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

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


{

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

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

Dept. Of CSE, BGSIT, B G NAGARA Page 32


AIR TRAFFIC CONTROL 2023-24

if(key=='a')

{
max+=1;
}

if(key=='r')

{
max-=1;
}

if(key=='q'|| key=='Q')
{
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);

Dept. Of CSE, BGSIT, B G NAGARA Page 33


AIR TRAFFIC CONTROL 2023-24

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);

glutAddMenuEntry("Quit 'q'",4);

glutAttachMenu(GLUT_LEFT_BUTTON);

glutAttachMenu(GLUT_RIGHT_BUTTON);

doInit();

glutMainLoop();

return 0;

Dept. Of CSE, BGSIT, B G NAGARA Page 34


AIR TRAFFIC CONTROL 2023-24

CHAPTER 6

RESULTS

Fig 6.1 HOMEPAGE

Fig 6.2 ADDING PLANES

Dept. Of CSE, BGSIT, B G NAGARA Page 35


AIR TRAFFIC CONTROL 2023-24

Fig 6.3 FLOWCHART

Fig 6.4 DELETING PLANES

Dept. Of CSE, BGSIT, B G NAGARA Page 36


AIR TRAFFIC CONTROL 2023-24

CHAPTER 7
CONCLUSION

In conclusion, an operating system can have significant implications for a project


that utilizes OpenGL. If situation where two or more processes are unable to proceed
because each is waiting for the other to release a resource. This can lead to a complete halt
in the system's progress, resulting in unresponsive or crashed applications. When working
with OpenGL, air traffic can occur when multiple processes or threads are attempting to
access shared OpenGL resources simultaneously, such as buffers, textures, or shaders. This
project aims at using glut pre-built model sub-app and callback functions. Finally we
conclude that this program clearly illustrate the use of glut model sub-app. and has been
completed successfully and is ready to be demonstrate. This can include the use of
mutexes, semaphores, or other concurrency control mechanisms to ensure that shared
resources are accessed in a mutually exclusive manner. Additionally, careful design and
planning of the application's work flow can help prevent situations where deadlocks are
more likely to occur. Overall, understanding the concepts of concurrency and
synchronization is crucial when developing an OpenGL project within an operating
system.

Dept. Of CSE, BGSIT, B G NAGARA Page 37


AIR TRAFFIC CONTROL 2023-24

CHAPTER 8
REFERENCES

BOOKS

• INTERACTIVE COMPUTER GRAPHICS A TOP-DOWN APPROACH

-By Edward Angel.

• COMPUTER GRAPHICS,PRINCIPLES & PRACTICES

- Foley van dam

- Feiner hughes

WEBSITES

• www.OpenGL Redbook.com
• www.OpenGL simple examples.
• www.OpenGL programming guide.
• http://www.wikipedia.com
• http://basic4gl.wikispaces.com
• http://www.opengl.org
•http://pyopengl.sourceforge.net/documentation/manual/glut.3GLUT.html

Dept. Of CSE, BGSIT, B G NAGARA Page 38


AIR TRAFFIC CONTROL 2023-24

CHAPTER 8
BIBLIOGRAPHY

BOOKS

• INTERACTIVE COMPUTER GRAPHICS A TOP-DOWN APPROACH

-By Edward Angel.

• COMPUTER GRAPHICS,PRINCIPLES & PRACTICES

- Foley van dam

- Feiner hughes

WEBSITES

• www.OpenGL Redbook.com
• www.OpenGL simple examples.
• www.OpenGL programming guide.
• http://www.wikipedia.com
• http://basic4gl.wikispaces.com
• http://www.opengl.org
•http://pyopengl.sourceforge.net/documentation/manual/glut.3GLUT.html

Dept. Of CSE, BGSIT, B G NAGARA Page 39

You might also like