0% found this document useful (0 votes)
426 views18 pages

Chapter - 1: Aeroplane Crash

The document discusses the history and applications of computer graphics and OpenGL. It provides an overview of how computer graphics has evolved from early expensive equipment to widespread use today in fields like engineering, science, medicine, business, art and entertainment. It then discusses 7 major applications of computer graphics including CAD, presentations, computer art, entertainment, education/training, image processing and user interfaces. The document concludes by introducing OpenGL, describing its library organization and command syntax, and listing advantages of using OpenGL like its industry standardization, stability, portability and ability to evolve with new hardware innovations.

Uploaded by

Bharani
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
0% found this document useful (0 votes)
426 views18 pages

Chapter - 1: Aeroplane Crash

The document discusses the history and applications of computer graphics and OpenGL. It provides an overview of how computer graphics has evolved from early expensive equipment to widespread use today in fields like engineering, science, medicine, business, art and entertainment. It then discusses 7 major applications of computer graphics including CAD, presentations, computer art, entertainment, education/training, image processing and user interfaces. The document concludes by introducing OpenGL, describing its library organization and command syntax, and listing advantages of using OpenGL like its industry standardization, stability, portability and ability to evolve with new hardware innovations.

Uploaded by

Bharani
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/ 18

AEROPLANE CRASH

CHAPTER - 1
INTRODUCTION

1.1 Overview of Computer Graphics:


Computer Graphics become a powerful tool for the rapid and economical production of
pictures. There is virtually no area in which Graphical displays cannot be used to some
advantage so it is not surprising to find the use of CG so widespread.

Although early application in engineering & science had to relay on expensive &
cumbersome equipments, advances in computer technology have made interactive computer
graphics a practical tool. Today it found Computer Graphics in a diverse area such as science,
engineering, medicine, business, industry, government, art, entertainment, education and
training. Now you are able to answer about computer graphics as generalized tool for
drawing and creating pictures and simulate the real world situations within a small computer
window.

History
William fetter was credited with coining the term Computer Graphics in 1960, to describe his
work at Boeng. One of the first displays of computer animation was future world (1976),
which included an animation of a human face and hand-produced by Carmull and Fred Parkle
at the University of Utah.

There are several international conferences and journals where the most significant results in
computer-graphics are published. Among them are the SIGGRAPH and Euro graphics
conferences and the association for computing machinery (ACM) transaction on Graphics
journals.

Applications of Computer Graphics


Nowadays Computer Graphics used in almost all the areas ranges from science, engineering,
medicine, business, industry, government, art, entertainment, education and training.

1) CG in the field of CAD:

Dept.OF CSE,PDIT Page 1


AEROPLANE CRASH

Computer Aided Design methods are routinely used in the design of buildings, automobiles,
aircraft, watercraft, spacecraft computers, textiles and many other applications.

2) CG in presentation Graphics:
Another major application area presentation graphics used to produce illustrations for reports
or generate slides. Presentation graphics is commonly used to summarize financial, statistical,
mathematical, scientific data for research reports and other types of reports.2D and 3D bar
chart to illustrate some mathematical or statistical report.

3)CG in computer Art:


CG methods are widely used in both fine art and commercial art applications. Artists use a
variety of computer methods including special purpose hardware, artist’s paintbrush program
(lumena), other pain packages, desktop packages, maths packages, animation packages that
provide facility for designing object motion. Ex: cartoons design is an example of computer
art which uses CG.

4)Entertainment:
Computer graphics methods are now commonly used in making motion pictures, music,
videos, games and sounds. Sometimes graphics objects are combined with the actors and live
scenes.

5)Education and Training:

Computer generated models of physical financial, economic system is often as education


aids. For some training application special systems are designed. Ex: specialized system is
simulator for practice sessions or training of ship captain, aircraft pilots and traffic control.

6) Image Processing:
Although the methods used in CG image processing overlap, the 2 areas are concerned with
fundamentally different operations. In CG a computer is used to create picture. Image

Dept.OF CSE,PDIT Page 2


AEROPLANE CRASH

processing on the other hand applies techniques to modify existing pictures such as photo
scans, TV scans.

7)User Interface:

It is common for software packages to provide a graphical interface. A major component of a


graphical interface is a window manager that allows a user to display multiple window area.
Interface also displays menus, icons for fast selection and processing.

2.1 Introduction to OpenGL:


OpenGL is a software interface to graphics hardware. This interface consists of about 150
distinct commands that you use to specify the objects and operations needed to produce
interactive three-dimensional applications. OpenGL is designed as a streamlined, hardware-
independent interface to be implemented on many different hardware platforms.

Most of our application will be designed to access OpenGL directly through functions in
three libraries. Functions in the main GL (or OpenGL in windows) library have names that
begin with the letters gl and are stored in a library usually referred to as GL (or OpenGL in
windows). The second is the OpenGL Utility Library (GLU). This library uses only GL
functions but contains code for creating common objects and simplifying viewing. All
functions in GLU can be created from the core GL library but application programmers prefer
not to write the code repeatedly. The GLU library is available in all OpenGL
implementations; functions in the GLU library begin with letters glu
.
To interface with the window system and to get input from external devices into our
programs, we need at least one more library. For each major window system there is a
system-specific library that provides the “glu” between the window system and OpenGL. For
the X window system, this library is called GLX, for windows, it is wgl, and for the
Macintosh, it is a gl. Rather than using a different library for each system, we use a readily
available library called the OpenGL Utility Toolkit (GLUT), which provides the minimum
functionality that should be expected in any modern windowing system.

Dept.OF CSE,PDIT Page 3


AEROPLANE CRASH

Fig.1 shows the organization of the libraries for an X Window System environment. For this
window system, GLUT will use GLX and the X libraries. The application program, however,
can use only GLUT functions and thus can be recompiled with the GLUT library for other
window systems.

GLU

GL
OpenGL application Frame
Program Xlib, Xtk Buffer

GLUT

GLX

Fig 1. Library organization of OpenGL

OpenGL Command Syntax


OpenGL commands use the prefix gl and initial capital letters for each word making up the
command name. Similarly, OpenGL defined constants begin with GL_, use all capital letters,
and use underscores to separate words (like GL_TRUE).
Some extraneous letters are appended to some command names (for example, the 3f in
glColor3f() and glVertex3f()). It's true that the Color part of the command name glColor3f()
is enough to define the command as one that sets the current color. However, more than one
such command has been defined so as to use different types of arguments. In particular, the 3
part of the suffix indicates that three arguments are given; another version of the Color
command takes four arguments. The part of the suffix indicates that the arguments are
floating-point numbers. Having different formats allows OpenGL to accept the user's data.

Dept.OF CSE,PDIT Page 4


AEROPLANE CRASH

Some OpenGL commands accept as many as 8 different data types for their
arguments. The letters used as suffixes to specify these data types for ISO C implementations
of OpenGL are shown in Table.1, along with the corresponding OpenGL type definitions

Table 1. Command Suffixes and Argument Data Types

Suffi Data Type Typical Corresponding OpenGL Type


x C-Language Type Definition

B 8-bit integer Signed char GLbyte

S 16-bit integer Short GLshort

I 32-bit integer int or long GLint, GLsizei

F 32-bit floating-point Float GLfloat, GLclampf

D 64-bit floating-point Double GLdouble, GLclampd

Ub 8-bit unsigned integer unsigned char GLubyte, GLboolean

Us 16-bit unsigned integer unsigned short GLushort

Ui 32-bit unsigned integer unsigned int or unsigned GLuint,GLenum,


long Lbitfield

Advantages of Using OpenGL


 Industry standard: An independent consortium, the OpenGL Architecture Review
Board, guides the OpenGL specification. With broad industry support, OpenGL is the
only truly open, vendor-neutral, multiplatform graphics standard.
 Stable: OpenGL implementations have been available for more than seven years on a
wide variety of platforms. Additions to the specification are well controlled, and proposed

Dept.OF CSE,PDIT Page 5


AEROPLANE CRASH

updates are announced in time for developers to adopt changes. Backward compatibility
requirements ensure that existing applications do not become obsolete.
 Reliable and portable: All OpenGL applications produce consistent visual display
results on any OpenGL API-compliant hardware, regardless of operating system or
windowing system.
 Evolving: Because of its thorough and forward-looking design, OpenGL allows new
hardware innovations to be accessible through the API via the OpenGL extension
mechanism. In this way, innovations appear in the API in a timely fashion, letting
application developers and hardware vendors incorporate new features into their normal
product release cycles.

CHAPTER 2

HARDWARE AND SOFTWARE REQURIMENTS

Dept.OF CSE,PDIT Page 6


AEROPLANE CRASH

Requirement Specification:
A Software requirements definition is an abstract description of the service which the system
should provide, and the constraints and which system must operate.it should only specify the
external behaviour of the system.

2.1 Hardware Requirement:


 Intel CORE Duo (Processor).
 4 GB Ram
 Hard disk 496 GB

2.2 Software Specifications:


 Operating System : WINDOWS 7
 Programming language: HTML,PHP,SQL

CHAPTER 3
DESIGN
User Defined Functions:

Dept.OF CSE,PDIT Page 7


AEROPLANE CRASH

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

2) 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()
3) timerfunc():This function starts a timer in the event loop that delays the event loop for
delay miiliseconds.

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

5) PushMatrix(): Save the present values of attributes and matrices placing ,or pushing on
the top of the stack.

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

7) Translated():In translate func the variables are components of the displacement


vector.

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

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

CHAPTER – 4

Dept.OF CSE,PDIT Page 8


AEROPLANE CRASH

IMPLEMENTATION

The whole program has been implemented in C language. The bottom line of the design is
Rotation, mouse interaction, keyboard interaction and some minor functions to print the text
on the screen. With the help of keyboard interaction and mouse interaction a player can
switch to different pages and can play the game etc.

In this project we have created a airplane crashing using opengl functional API we have taken
the help of built in functions present in the header file to provide functionally to our project
we have written sub functions. These functions provide us the efficient way to design the
project. In this project chapter we are describing the functionality of our project using these
functions.

1.Module for back wing :


glBegin(GL_POLYGON);
glVertex2f(0.0,55.0);
glVertex2f(0.0,80.0);
glVertex2f(10.0,80.0);
glVertex2f(40.0,55.0);
glEnd();
glPopMatrix();
glPushMatrix();
glTranslated(a,c,0.0);
glColor3f(1.0,0.0,0.0);

2.Module for left side wing:


glBegin(GL_POLYGON);
glVertex2f(65.0,55.0);
glVertex2f(50.0,70.0);
glVertex2f(75.0,70.0);
glVertex2f(90.0,55.0);
glEnd();
glPopMatrix();
glPushMatrix();
glTranslated(a,c,0.0);
glColor3f(1.0,0.0,0.0);

3.Module for rightside wing:


glBegin(GL_POLYGON);
glVertex2f(70.0,40.0);

Dept.OF CSE,PDIT Page 9


AEROPLANE CRASH

glVertex2f(100.0,40.0);
glVertex2f(80.0,15.0);
glVertex2f(50.0,15.0);
glEnd();
glPopMatrix();
if(c>360) //timer to jump to next display
{
display2();
d+=20;//plane takeoff on x in 2nd display
}
if(a>500.0)//window position during take off
{
a=0.0;
b=0.0;
}
if(c>750)//timer to jump to 3rd display
{
display3();
e+=20;//plane takeoff on x in 3rd display
if(e>250)//timer to call blast function
{
blast();
e=250;
}
}
glFlush();
}

4.Module for upper triangle of building:


glBegin(GL_POLYGON);
glVertex2f(400.0,400.0);
glVertex2f(350.0,480.0);
glVertex2f(400.0,480.0);
glEnd();
glColor3f(0.0,0.0,0.0);

5.Module for seperation line of floors:


glBegin(GL_LINES);
glVertex2f(350.0,180);
glVertex2f(400.0,100);
glEnd();
glColor3f(0.0,0.0,0.0);
glBegin(GL_LINES);

Dept.OF CSE,PDIT Page 10


AEROPLANE CRASH

glVertex2f(350.0,280);
glVertex2f(400.0,200);
glEnd();
glColor3f(0.0,0.0,0.0);
glBegin(GL_LINES);
glVertex2f(350.0,380);
glVertex2f(400.0,300);
glEnd();
glColor3f(0.0,0.0,0.0);
glBegin(GL_LINES);
glVertex2f(450.0,100);
glVertex2f(400.0,100);
glEnd();
glColor3f(0.0,0.0,0.0);
glBegin(GL_LINES);
glVertex2f(450.0,200);
glVertex2f(400.0,200);
glEnd();
glColor3f(0.0,0.0,0.0);
glBegin(GL_LINES);
glVertex2f(450.0,300);
glVertex2f(400.0,300);
glColor3f(0.0,0.0,0.0);
glBegin(GL_LINES);
glVertex2f(350.0,180);
glEnd();
build_outline();
}

6.Module for building out lines:


void build_outline(){
glColor3f(0.0,0.0,0.0);
glBegin(GL_LINE_LOOP);
glVertex2f(350.0,80.0);
glVertex2f(350.0,480.0);
glVertex2f(400.0,400.0);
glVertex2f(400.0,0.0);
glEnd();
glColor3f(0.0,0.0,0.0);
glBegin(GL_LINE_LOOP);
glVertex2f(400.0,0.0);
glVertex2f(400.0,400.0);

Dept.OF CSE,PDIT Page 11


AEROPLANE CRASH

glVertex2f(450.0,400.0);
glVertex2f(450.0,0.0);
glEnd();
glColor3f(0.0,0.0,0.0);
glBegin(GL_LINE_LOOP);
glVertex2f(400.0,400.0);
glVertex2f(350.0,480.0);
glVertex2f(400.0,480.0);
glVertex2f(450.0,400.0);
glEnd();
}

7.Module for blast polygon construction:


void blast(void)//blast polygon construction
{
glPushMatrix();
glTranslated(-10.0,-60.0,0.0);
glColor3f(1.0,0.0,0.0);
glBegin(GL_POLYGON);
glVertex2f(404.4,320.0);
glVertex2f(384.0,285.0);
glVertex2f(368.0,344.5);
glVertex2f(344.0,355.0);
glVertex2f(347.2,414.5);
glVertex2f(332.8,442.5);
glVertex2f(347.2,477.5);
glVertex2f(352.0,530.0);
glVertex2f(379.2,519.5);
glVertex2f(396.8,565.0);
glVertex2f(416.0,530.0);
glVertex2f(440.0,547.5);
glVertex2f(452.8,512.5);
glVertex2f(472.0,512.5);
glVertex2f(475.2,470.5);
glVertex2f(488.0,442.5);
glVertex2f(488.0,404.0);
glVertex2f(470.0,372.5);
glVertex2f(475.2,337.5);
glVertex2f(464.0,306.0);
glVertex2f(444.8,320.0);
glVertex2f(425.6,285.0);
glVertex2f(404.8,320.0);
glEnd();

Dept.OF CSE,PDIT Page 12


AEROPLANE CRASH

glPopMatrix();
}

8.Module for white strips on road:


glBegin(GL_POLYGON);// glVertex2f(0.0,40.0);
glVertex2f(8.0,60.0);
glVertex2f(58.0,60.0);
glVertex2f(50.0,40.0);
glEnd();
glPopMatrix();
glPushMatrix();
glTranslated(b,0.0,0.0);
glColor3f(1.0,1.0,1.0);
glBegin(GL_POLYGON);
glVertex2f(100.0,40.0);
glVertex2f(108.0,60.0);
glVertex2f(158.0,60.0);
glVertex2f(150.0,40.0);
glEnd();
glPopMatrix();
glPushMatrix();
glTranslated(b,0.0,0.0);
glColor3f(1.0,1.0,1.0);
glBegin(GL_POLYGON);
glVertex2f(200.0,40.0);
glVertex2f(208.0,60.0);
glVertex2f(258.0,60.0);
glVertex2f(250.0,40.0);
glEnd();
glPopMatrix();
glPushMatrix();
glTranslated(b,0.0,0.0);
glColor3f(1.0,1.0,1.0);
glBegin(GL_POLYGON);
glVertex2f(300.0,40.0);
glVertex2f(308.0,60.0);
glVertex2f(358.0,60.0);
glVertex2f(350.0,40.0);
glEnd();
glPopMatrix();
glPushMatrix();
glTranslated(b,0.0,0.0);
glColor3f(1.0,1.0,1.0);

Dept.OF CSE,PDIT Page 13


AEROPLANE CRASH

glBegin(GL_POLYGON);
glVertex2f(400.0,40.0);
glVertex2f(408.0,60.0);
glVertex2f(458.0,60.0);
glVertex2f(450.0,40.0);
glEnd();
glPopMatrix();
}

9.Module for initialization function:


void myinit()
{
glClearColor(0.0f,0.0f,1.0f,0.0f);
glColor3f(1.0,0.0,0.0);
glPointSize(1.0);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluOrtho2D(0.0,499.0,0.0,499.0);
}

10.Module to main function:


void main(int argc, char* argv[])
{
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB);
glutInitWindowSize(500.0,500.0);
glutInitWindowPosition(0,0);
glutCreateWindow("AERO");
glutDisplayFunc(display);
myinit();
glutTimerFunc(100,update,0);
glutMainLoop();
}

CHAPTER – 5
SNAPSHOTS
Fig 1: Plane ready to take-off

Dept.OF CSE,PDIT Page 14


AEROPLANE CRASH

Fig 2:Plane in the sky

Fig 3: Plane moving towards the building

Dept.OF CSE,PDIT Page 15


AEROPLANE CRASH

Fig 4: Plane crashing

CHAPTER 6

Dept.OF CSE,PDIT Page 16


AEROPLANE CRASH

CONCLUSION
This project is one of the sample project on Computer Graphics. Though many difficulties
were faced during the project as well as many errors occurred, we became succeed to com-
pile and run the program. There may be some limitations on this project as well, so, in the
near future we would like to be hopeful in further improvements. We are highly obliged to all
helping hands and to all inspirations to make this project successful. Well this project will be
applicable to most of all. As well as, we are more hopeful for more advice, new ideas and
inspiration to make more other projects. To had tried our best to include each and every basic
features of graphics in our projects.

We aimed it to be an interfacing application to the real world that means our project must not
be an project for any examination but also applicable for real world use. We have able to give
some benefits to the disability. It somehow makes our life easier in this or that way. From
this very project we were able to achieve various knowledge in computer graphics and also
in logical coding. We refresh our knowledge in C Programming. Moreover we also gained an
experience of group work, team coordination. We learned how team work is very much
important in engineering field.

CHAPTER 7

Dept.OF CSE,PDIT Page 17


AEROPLANE CRASH

REFERENCES

[1] Donald, Hearn. Computer Graphics. Pearson Education: 2005, Pearson Education.

[2] www.learnstreet.com

[3] http://www.sourcecodesworld.com/

Dept.OF CSE,PDIT Page 18

You might also like