Download INTRODUCTION - GET HELP INSTANTLY

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

2.5D wikipedia , lookup

Tektronix 4010 wikipedia , lookup

Molecular graphics wikipedia , lookup

Waveform graphics wikipedia , lookup

Apple II graphics wikipedia , lookup

Framebuffer wikipedia , lookup

Graphics processing unit wikipedia , lookup

Mesa (computer graphics) wikipedia , lookup

OpenGL wikipedia , lookup

Transcript
VISVESVARAYA TECHNOLOGICAL UNIVERSITY
PROJECT REPORT
ON
LAUNCHING OF SPACE SHUTTLE
Submitted as per the course of
Bachelor of Engineering
in
COMPUTER SCIENCE and ENGINEERING
by
PAUL SUDEEP.G
PUNITH. K
1RE07CS054
1RE07CS060
Guided by:
Mr.Ashwin Kumar
&
Mrs.V.R.Prathima
REVA INSTITUTE OF TECHNOLOGY AND
MANAGEMENT
KATTIGENAHALLI, JALA HOBLI, YELAHANKA
BANGALORE – 560064
REVA INSTITUTE OF TECHNOLOGY
AND MANAGEMENT
Department of Computer Science & Engineering
Bangalore – 560 064
CERTIFICATE
This is to certify that the mini project titled “Launching of
Space
Shuttle
Paul
Sudeep.G
(USN:
”
has
(USN:
been
successfully
1RE07CS054)
completed
and
Punith.K
1RE07CS060) in partial fulfillment of the Mini Project in
the 6th semester B.E. (CSE) during the period
Feb – June 2010 as
prescribed by Visvesvaraya Technological University, Belgaum.
Examiner 1:
Guide:
Examiner 2:
HOD:
2
by
ACKNOWLEDGEMENT
We owe thanks to people who helped and supported us during the
implementing of this project. Our deepest thanks to Mr.Ashwin Kumar &
Mrs. V.R.Prathima the Guides of the project for guiding and correcting various
documents with attention and care. They have taken pain to go through the
project and make necessary correction as and when needed.
We express our thanks to the Principal Dr.RanaPratap Reddy, for
extending his support. Our deep sense of gratitude to our HOD,
Dr.VijayaKumar B.P , for his support and guidance. Thanks and appreciation
to the helpful people at Reva Institute of Technology and Management, for their
support.
We would also thank our Institution and our faculty members without
whom this project would have been a distant reality. We also extend our
heartfelt thanks to our family and well wishers.
3
CONTENTS
Particulars
4
Page.No.
Introduction to Open GL
01
Synopsis
04
Introduction to Space Shuttle
05
Introduction to Project
06
Requirements Specification
07
Design of the Project
08
Open GL Functions Used
09
Coding of the Project
12
Snapshots of the Project
18
Conclusion
20
Bibliography
21
INTRODUCTION
OpenGL is an API (Application Programming Interface) which provides the actual
drawing tool through a collection of functions that are called within an application.
It suits well for use in Computer Graphics because of its device independence or
portability. It offers a rich and highly usable API for 2D graphics and image manipulation.
Computer Graphics is concerned with all aspects of producing pictures or images
using a computer.
OpenGL is a graphics software system which has become a widely accepted standard
for developing graphics applications. It is easy to learn and it possesses most of the
characteristics of other popular graphics systems.
OpenGL is a software interface to graphics hardware. OpenGL is a library of
functions for fast 3D rendering.
The OpenGL Utility Library (GLU) provides many of the modeling features, such as
quadric surfaces and curves and surfaces. It is a standard part of every OpenGL
implementation.
OpenGL is the standard graphics library for building cross-platform, hardwareaccelerated, high performance visualization applications. While OpenGL is ideal for 3D
visualization, it offers little support for creating application user interfaces.
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.
GLUT (Graphical Language Utility Toolkit)
 Header File
 Dynamic Link File
 Library File
OpenGL is standard on almost all workstations. For systems that use Microsoft
Windows, the dynamic libraries for GL (OpenGL32.dll) and GLU (GLU32.dll) are in the
system folder. The corresponding .lib files and include files are provided with language
compliers such as Visual C++.
OpenGL.dll is a dynamic link library that begins to this application and is required in
order to display any graphics created using this powerful graphics engine.
OpenGL supports applications ranging from large scientific visualizations to cell
phone games. Three approaches are used in Computer Graphics:
5
 Algorithmic Approach
 Survey Approach
 Programming Approach
Without a good, clean, up-to-date copy of the opengl.dll file it is highly likely that
you will suffer problems when attempting to access certain applications, especially games
and graphics intensive applications.
OpenGL performs several processing steps on this data to convert it to pixels to
form the final desired image in the frame buffer.
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, normals, 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 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.
According to Von Neumann model, any computing system must contain the following four
components:
o
o
o
o
Input Unit
Output Unit
Memory Unit
Processing Unit
If a computing system must get graphics capabilities, then it must possess
6






Input Unit
Output Unit
Memory Unit
General Processing Unit
Frame Buffer (Display Buffer)
Display Processor
Frame Buffer is used to store bits. Display Processor matches the colors with bits.
The development of OpenGL resolved most of the difficulties like high cost, limited
availability, lack of generality and high complexity.
The frame buffer and display processor are the two components which are under
the control of a set of in-built functions supported by the OpenGL package. However, the
OpenGL package also provides the programmer with a set of functions using which the user
can also utilize the capabilities of the input device, general memory unit and general
processing unit.
.
7
SYNOPSIS
The space shuttle is a reusable orbital vehicle that transports
aerospace travelers. Officially titled the Space Transportation System (STS), the space
shuttle expands space exploration possibilities and contributes to better comprehension of
Earth. The orbiting shuttle enables astronauts to conduct experiments in a weightless
environment, deploy or repair satellites, and photographically survey the planet. The shuttle
aids building, equipping, and transporting of personnel to and from the International Space
Station (ISS). Only selected passengers, based on scientific, engineering, professional, or
piloting qualifications, can ride in the shuttle. The shuttle launches like a rocket, maneuvers
in Earth orbit like a spacecraft and lands like an airplane.
The space shuttle consists of three major components: the orbiter
which houses the crew; a large external fuel tank for the main engines; and two solid rocket
boosters which provide most of shuttle’s lift during the first two minutes of flight. All of the
components are reused except for the external fuel tank, which burns up in the atmosphere
after each launch.
The project has been developed in Visual C++ using Open GL
functions. In this design of graphics package, we are going to demonstrate launching of space
shuttle.
The animation developed can provide the best simulation for the
people interested in space aeronautics. It is simple representation of images using 2D pictures
and simple 2D animation.
8
Introduction to Space Shuttle
The space shuttle is the world’s first reusable space craft, and first spacecraft in
history that can carry large satellites both to and from orbit. The shuttle launches like a
rocket, maneuvers in earth orbit like a spacecraft and lands like an airplane.
The space shuttle consists of three major components: the orbiter which houses the
crew; a large external fuel tank that holds fuel for the main engines; and two solid rocket
boosters which provide most of the shuttle’s lift during the first two minutes of flight. All of
the components are reused except for the external fuel tank, which burns up in the
atmosphere after each launch.
The longest the shuttle has stayed in orbit on any single mission is 17.5 days on
Mission STS-80 in November 1996. Normally, missions may be planned for anywhere from
five to 16 days in duration. The smallest crew ever to fly on the shuttle numbered two people
on the first few missions. The largest crew numbered eight people. Normally, crews may be
range in size from five to seven people .The shuttle is designed to reach orbits ranging from
about 185 kilometers to 643 kilometers (115 statute miles to 400 statute miles) high.
The shuttle has the most reliable launch record of any rocket now in operation.
Since 1981, it has boosted more than 1.36 million kilograms (3 million pounds) of cargo into
orbit. More than 600 crew numbers have flown on its mission. Although it has been in
operation for than 20 years, the shuttle has continually evolved and is significantly different
today than when it first was launched. NASA has made literally thousands of major and
minor modifications to the original design that have made it safer, more eliable and more
capable today than ever before.
Since 1992 alone, NASA has made engine and system improvements that are
estimated to have tripled the safety of flying the space shuttle, and the number of problems
experienced while a space shuttle is in flight have decreased by one 70 percent. During the
same period, the cost of operating the shuttle has decreased by one and a quarter billion
dollars annually – a reduction of more than 40 percent. At the same time, because of weight
9
reduction and other improvements, the cargo the shuttle can carry has increased by 7.3 metric
tons (8 tons).
NASA has prepared to continue flying the shuttle for at least the next decade and
planes to continue to improve the shuttle during the next five years, with the goals of
increasing its safety by improving the highest risk components. NASA will also be working
to correct the problems identified by the Columbia Accident Investigation Board during the
investigation of the STS-107 accident.
In managing and operating the space shuttle, NASA holds the safety of the crew
as its highest priority.
Introduction to the Project:
The space shuttle is the world’s first reusable space craft, and first spacecraft in
history that can carry large satellites both to and from orbit. The shuttle launches like a
rocket, maneuvers in earth orbit like a spacecraft and lands like an airplane.
In the design of this Graphics package, we are going to demonstrate the procedure for
Launching of Space Shuttle.
Space Shuttle consists of a winged orbiter and two solid-rocket boosters. The shuttle
is launched from a vertical position. Liftoff thrust is derived from the orbiter's three main
liquid-propellant engines and the boosters. After 2 min the boosters use up their fuel, separate
from the spacecraft, and—after deployment of parachutes—are recovered following
splashdown. After some time of flight, the orbiter's main engines shut down; the external
tank is then jettisoned and burns up as it reenters the atmosphere. The orbiter meanwhile
enters orbit after a short burn of its two small Orbiting Maneuvering System (OMS) engines.
To return to earth, the orbiter turns around, fires its OMS engines to reduce speed, and, after
descending through the atmosphere, lands like a glider. But in the project here we only depict
the process of launching of the space shuttle.
10
REQUIREMENT SPECIFICATION
Hardware specifications
1 Processor: Pentium
: 360 MHz machine or above.
2 Main memory
: 128 MB RAM or more.
3 Hard disk space
: 500MB
4 Monitor
: 16 Bit color
Software specifications
1 Operating system: Windows 98 or higher.
2. Front end
11
: Visual C++.
DESIGN OF THE PROJECT
This project has been developed using visual C++, which is a
function oriented language. Function oriented design conceals the details of an algorithm in a
function but system state information is not hidden. This can cause problems because a
function can change the state away, which other functions don't expect. Changes to a
function and the way in which it uses a system state may cause unanticipated changes in the
behavior of other functions. Functional approach to design is therefore most likely to be
successful when the amount of system state information is minimized and information
sharing is explicit, so the implementation technique used is procedural is a general purpose
structured programming language that is powerful, efficient and compact. Compiler
combines the capability of an assembly language with the features of a high level languages
and therefore is well suited for writing both software and business packages. Programs
written in C++ are fast and efficient. This is due to variety of data types and powerful
operators. C++ is highly portable.
In this Visual C++ we have used Open GL APIs to build our
project like glVertex2f(), glBegin(), glutCreateWindow(),glColor3f() etc. with different color
functions that helped to build the graphical design a lot. The Open GL APIs provides a class
of libraries for the user with the set of facilities to handle the graphics operations efficiently.
So the implementation written in C++ programming language also includes many header file.
12
Functions used from Open GL
Functions
glVertex*( ) :
Descriptions
The general form of vertex function, where * can
interpreted as either two or three characters of
the form nt or ntv , where n signifies the number of
dimensions (2,3 or 4); t denotes the data types, such
as integer (i), float (f), or double (d) and v if present
indicates that variables are specified through a pointer
to an array ,rather than through an argument list.
glBegin( ) and glEnd( ):
The argument of glBegin specifies the geometric type
that we want our vertices to to define. We can group as
many vertices as we wish between the functions
glBegin and glEnd.
glFlush( ) :
The call to glFlush ensures that points are rendered
to the screen as soon as possible.
glColor3f( ):
It conveys that we are using three color(RGB)model
and 3f is used in a manner similar to the glVertex
function, where f indicates the values are in floats.
glClearColor( ):
To clear an area of the screen , a drawing window
in which to display our output or whenever we want
to draw a new frame.
glPointSize( ):
We can set the size of rendered points to be pixel wide
value.
13
gluOrtho2D( ):
Orthographic viewing, all parameters which are passed
to this function indicates distance measured from the
camera. The orthographic projection sees only those
objects in the volume specified by viewing volume.
glutInit(int *argc,char **argv ):
Interaction between the windowing system and Opengl
The two arguments allow the user to pass command
line arguments.
glutCreateWindow(char *title):
Used to open an Opengl window using glut function.
Where the title at the top of the window is given by
the string title.
glutInitDisplayMode( ):
It is used to specify the display mode such as color,
buffering and also depth buffer for hidden surface
removal.
glutInitWindowSize( ):
glutInitWindowPosition( ):
glutMainLoop( ):
This function specifies size of the window.
This function specifies position of our window.
The execution of this function will cause the program to
begin an event processing loop. If there are no event to
process, the program will sit in a wait state, with our
graphics on the screen, until we terminate the program.
glutDisplayFunc(void (*func)(void)):
Graphics are sent to the screen through a function called
14
the display callback. Here the function named func will
called whenever the window system determines that the
opengl window needs to be redisplayed.
glMatrixMode( ):
We select the matrix to which the operations apply by
first setting the matrix mode.To alter the position matrix
we must first switch the modes.
glutPostRedisplay( ):
Indicating that the display needs to be redrawn and it
ensures that the display will be drawn only once each
the program goes through the event loop.
glutSwapBuffers( ):
Swaps the front and back buffers
glPushMatrix( ) & :
Pushes to and pops from the matrix stack corresponding to
glPopMatrix( )
the current matrix mode.
15
CODING OF THE PROJECT
The project has been developed in Visual C++ using OpenGL, which has become a
widely accepted standard for developing graphics application. Fortunately, OpenGL is easy
to learn, and it possesses most of the characteristics of other popular graphics systems.
In the design of this graphics package, we are going to demonstrate ‘Launching of
Space Shuttle’; it is a simple representation of 2D images by using visual C++ as software.
Most of our applications will be designed to access OpenGL directly through
functions in three libraries. Functions in main GL (or OpenGL in windows) library have
names that begin with letters gl are stored in 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. The GLU
library is available in all OpenGL implementations; functions in the GLU library begin with
the letters glu.We use library called OpenGL Utility Toolkit (GLUT), which provides the
minimum functionality that should be expected in any
modern windowing system.
OpenGL supports two classes of primitives: geometric primitives and raster
primitives. Geometric primitives are specified in the problem domain and include points, line
segments, curves, polygons, and surfaces. These primitives pass through a geometric
pipeline, where they are subjected to series of geometric operations, which determine
whether a primitive is visible, where on the display it appears if it is visible, and the
rasterization of the primitive into pixels in the frame buffer.
The basic OpenGL geometrics primitives are specified by sets of vertices. Thus, the
programmer defines his objects with sequence of the following form:
16
glBegin(type);
glVertex*(…..);
.
.
.
.
glVertex*(….);
glEnd( );
The value of type specifies how OpenGL assembles the vertices to define geometric
objects. The other code and OpenGL function calls can occur between glBegin and glEnd. If
we wish to display points or line segments, we have a few choices in OpenGL. The
primitives and their type specifications include the following:
Points (GL_POINTS): Each vertex is displayed at a size of at least one pixel.
Line segments (GL_LINES): The line segment type causes successive pairs of vertices to
be interpreted as the endpoints of individual segments.
Polylines (GL_LINE_STRIP, GL_LINE_LOOP): If successive vertices are to be
connected, we can use the line strip or polyline form. The GL_LINE_LOOP type, which will
draw a line segment from the final vertex to the first, thus, creates a closed path.
Polygons (GL_POLYGON): Successive vertices define line segments, and a line segment
connects the final vertex to the first. The interior is filled according to the state of the relevant
attributes. For example
glBegin(GL_POLYGON);
glVertex2i(550,350);
glVertex2i(962,350);
glVertex2i(962,370);
glVertex2i(550,370);
glEnd();
17
The above simple code uses polygon type in which we have passed different colors to
the function glColor3f ( ) to render the polygon, within the function glBegin and glEnd.
We use window, or screen window, to denote a rectangular area of our display. We are
concerned with the only with the raster displays. A window has a height and width, and
because the window displays the contents of the frame buffer, positions in the window are
measured in window or screen coordinates, where the units are pixels
.
Before we can open a window, there must be interaction between the windowing
system and OpenGL. In GLUT, this interaction is initiated by following function call:
glutInit(int *argv,char ** argv)
The two arguments allow user to pass command line arguments, as in the standard C
main function, and are usually the same as in main. We can now open an OpenGL window
using the glut function
glutCreateWindow (char *title)
Where title at the top of the window is given by the string title. The window that we
create has a default size, position on the screen, and characters such as the use of RGB color.
We can also use GLUT functions before window creation to specify these parameters .for
example, the code
glutInitDisplayMode (GLUT_DOUBLE | GLUT_RGB );
glutInitWindowSize (1024,768);
glutInitWindowPosition (0.0,0.0);
specifies 1024*768 window in the top left corner of the display. We specify RGB rather than
indexed (GLUT_INDEX)color, a depth buffer for hidden surface removal, and
single(GLUT_SINGLE )buffering.
In this this project we have used the glutIdleFunc()
which sets the global idle callback to be func so a GLUT program can perform
18
background processing tasks or continuous animation when window system events are not
being received. If enabled, the idle callback is continuously called when events are not being
received. The callback routine has no parameters. The current window and current menu will
not be changed before the idle callback. Programs with multiple windows and/or menus
should explicitly set the current window and/or current menu and not rely on its current setting.
Usage:
voi d gl ut Idl eFun c(v oi d
(*func) ( v o i d ) ) ;
We have also made use of the
midpoint Circle drawing algorithm in the project. It is
also
called
as
the
Bresenham’s
Circle
Drawing
algorithm.The algorithm is as follows:
void Circle_draw(GLint h, GLint k, GLint r)
//To Draw Circle
{
GLint d =
1-r, x=0, y=r;
while(y > x)
{
plotpixels(h,k,x,y);
if(d < 0) d+=2*x+3;
else
{d+=2*(x-y)+5;
--y;
}
++x;
}
plotpixels(h,k,x,y);
}
19
The function call to the launch of the space shuttle includes the use of pushMatrix()
and the popMatrix() in the display function. It is as shown below:
void display()
{
glClear(GL_COLOR_BUFFER_BIT);
base();
stand();
flag();
glPointSize(1.1);
Circle_draw(90,520,8);
stars();
glPushMatrix();
smoke();
glPopMatrix();
glPushMatrix();
holder();
glPopMatrix();
glPushMatrix();
shuttle();
Circle_draw(500,328,7);
glPopMatrix();
glFlush();
glutSwapBuffers();
}
20
The Control of the movement of the space shuttle and other movements are defined in a
separate function as shown below:
void move()
{
y+=0.3;
x+=1.0;
z+=0.18;
glutPostRedisplay();
}
The main() function has been defined as shown below:
void main(int argc,char** argv)
{
glutInit(&argc,argv);
glutInitDisplayMode(GLUT_DOUBLE|GLUT_RGB);
glutInitWindowSize(1024,768);
glutInitWindowPosition(0,0);
glutCreateWindow("SPACE SHUTTLE");
glutDisplayFunc(display);
glutIdleFunc(move);
init();
glutMainLoop();
}
21
SNAP SHOTS OF THE PROJECT
BEFORE LAUNCHING
22
AFTER LAUNCHING:
23
CONCLUSION
This graphics package has been successfully implemented in
Visual C++ using Open GL APIs in windows based platform. In this animation we have used
various library functions available in Visual C++ and Open GL.
The animation developed can provide the best simulation for the
people interested in space aeronautics. It is a simple representation of images using 2D
pictures and simple 2D animation. This can be well implemented using any image support
processing language.
This project could be still implemented in a better way with good
interface and animations. More realistic modeling of the shuttle as well as the environment is
still possible. The various stages involved in the actual launching can also be implemented
here. In this project we only indicate the basic process involved. I welcome constructive
comments from the critics so that our project could be made still better.
24
Bibliography
1 Computer Graphics Using OPENGL
By Edward Angel
2 Computer Graphics
By Foley Van Dam and Feiner Hughes
3 Procedural Elements For Computer Graphics
By David.F.Rogers
4 Computer Graphics: Principles and practices
By James D Foley, Andries Van Dam, Feiner and Hughes
25