2
2
CHAPTER 1
INTRODUCTION
A flight simulator is a device that simulates the flight of an aircraft, as well as its
environment and any events that may occur while it is in the air. It’s a universe where
anyone can be a pilot, learn to fly, or simply play without having to use the original
plane. In this case, prospective pilots and airline pilots must study in a flight simulator.
To aid this pilot prospective study, the flight simulator should be built to mimic the
realistic circumstances they would face when flying. Equations describing how an
aircraft flies, how flight controls respond when triggered, the effects of other aircraft
systems, and more must be included in this device and this outlines how an aeroplane
reacts to various factors such as damping and gravity.
1
CGV Lab Mini Project “Airplane Crash”
With the help of this project, we intend to design a game that solves a Rubik’s cube.
This project has been created using C++ and openGL. A Rubik’s cube is composed of
26 smaller cube lets, and the 54-cube let faces that are visible on the cube are displayed
in this cube net. The colors of each of the center cube let faces are fixed in the cube net,
helping orient the user. It is reasonably likely that the user will make an error when
inputting the cube configuration, so our system runs a check on the desired starting
configuration to make sure it is solvable before allowing the user to proceed. The user
cannot trigger rotations on the 3D visualization of the cube until the configuration is
valid. The process of solving a cube with a valid starting configuration is
communicated to the user via a 3D animation displayed on the computer monitor.
As in Thistle Thwaite’s, we use 4 phases narrow down the cube group and end at the
solved state. After the completion of each phase the number of different moves we use
to get to the next goes down, letting us cut down on the branching factor which is the
exponential base of the universal cover of the graph we are doing our BFS in. OpenGL
(Open Visuals Library) is a language-independent, cross-platform, hardware-
accelerated API for creating 3D (and 2D) graphics. Modern computers have a
dedicated GPU (Graphics Processing Unit) with its own memory to speed up graphics
rendering. OpenGL is the software interface to graphics hardware. In other words, the
OpenGL graphic rendering requests from your programmes could be sent to and
accelerated by the visual hardware. Three sets of libraries are used in our OpenGL.
2
CGV Lab Mini Project “Airplane Crash”
This research shows a method for 3-D reconstruction and visualisation of geological
materials using the IDL programmable data analysis and visualisation environment.
Custom IDL programmes for importing, filtering, and visualising data from precision
serial lapping are described by the authors. It is capable of sequentially reading and
importing categorised raster images into a voxel array. To provide consistent 3-D
reconstruction and noise reduction, the voxel array can be processed by median and/or
binary filter programmes with variably shaped filter kernels. A voxel-projecting
programme and a surface-rendering application can be used to visualise the filtered
results. The IDL slicer application is also demonstrated, which is a 3-D analysis and
visualisation tool included in the standard IDL edition.
3
CGV Lab Mini Project “Airplane Crash”
instructions beginning with the letter ”gl” make up the core of OpenGL (GL) (e.g.,
glColor, glVertex, glTranslate, glRotate). Core OpenGL models an object using a set of
geometric primitives such as point, line, and polygon. GLU (OpenGL Utility Library)
is a library built on top of OpenGL to give useful utilities (such camera view and
projection) and more building models (such as quadric surfaces and polygon
tessellation). The prefix ”glu” is used in GLU commands (e.g., gluLookAt,
gluPerspective). GLUT (OpenGL Utilities Toolkit): OpenGL is meant to work
regardless of the windowing system or operating system. GLUT is required to
communicate with the operating system, as well as to provide additional building
models (such as sphere and torus). The ”glut” prefix is used in GLUT commands (e.g.,
glutCreatewindow, glutMouseFunc). GLUT is a platform-independent OpenGL
extension that is built on top of platform-specific OpenGL extensions like GLX for the
X Window System, WGL for Microsoft Windows, and AGL, CGL, or Cocoa for Mac
OS. According to the website opengl.org: ”GLUT is a tool for constructing small to
medium-sized OpenGL applications. GLUT is a wonderful tool for learning OpenGL
and building little OpenGL apps, but it isn’t a full-featured toolkit,therefore large
applications with rich user interfaces should use native window system toolkits. GLUT
is a small, basic, and userfriendly programme.” SDL is a GLUT replacement.
The aim of this project is to create an interesting and creative game using tools like
OpenGL and C++ (g++ compiler).
Apart from the gameplay, this project also deals with providing a beautiful graphical
interface between the user and the system.
4
CGV Lab Mini Project “Airplane Crash”
The main theme of this project is to display the Aeroplane flying from one end to
another
end or to reach the destination successfully with basic computer graphics. This graphics
package is based on the OpenGL library functions. The programming language used
here
is C using OpenGL libraries.
In this game an Aeroplane flying from one end to another end and reach the destination
successfully by crossing all the obstacles which occur in the path of the plane, the
player has to control the plane upwards and downwards using the keyboard to avoid the
collision with obstacles.
This game consists of three levels in each level the speed of the plane as well as the
speed of the obstacles going to increase, if a collision occurs between plane and
obstacles then the game will be over. And in the end, it will show us the number of
levels successfully completed by the player.
5
CGV Lab Mini Project “Airplane Crash”
CHAPTER 2
In this chapter, we explain some basic information about Computer Graphics and
openGL.
• Display of information.
• Design for animated games.
6
CGV Lab Mini Project “Airplane Crash”
Display of information:
Design:
Professional such as engineering and architecture are concerned with design. The use of
interactive graphics tools in computer aided design pervades fields. Including as
architecture, mechanical engineering, the design of very large-scale integrated circuits
and the creation of character for animations.
User interfaces:
Interaction with computers has become dominated by a visual paradigm that includes
windows, icons, menus and plotting device such as mouse. User interfaces demonstrate
the variety of the available in high level modelling packages and the interactive devices
the user can employ in modelling geometric objects.
7
CGV Lab Mini Project “Airplane Crash”
2.3 Open GL
Graphics provide one of the most natural means of communicating with a computer,
since our highly developed 2D and 3D pattern-recognition abilities allow us to perceive
and process pictorial data rapidly and efficiently.
OpenGL drawing commands are limited to those that generate simple geometric
primitive, GLUT includes several routines that creates more complicated three-
dimensional objects such as a sphere, a torus and a teapot.
The OpenGL Utility Library, GLU also has quadrics routines that create some
of the same three-dimensional objects as GLUT, such as a sphere, cylinder or cone.
8
CGV Lab Mini Project “Airplane Crash”
9
CGV Lab Mini Project “Airplane Crash”
CHAPTER 3
REQUIREMENT SPECIFICATION
The system is made up of units that are put together to work as one in order to achieve a
common goal. The requirements for implementation of the new system are:
1. The Hardware
2. The Software
Software: openGL
10
CGV Lab Mini Project “Airplane Crash”
11
CGV Lab Mini Project “Airplane Crash”
CHAPTER 4
SOFTWARE DESIGN
This chapter gives us some information on System Design, Transformation Functions
and Rotation.
Existing System:
Existing system for a graphics is the TC++. This system will support only the
2D graphics. 2D graphics package being designed should be easy to use and
understand. It should provide various option such as free hand drawing, line drawing,
polygon drawing, filled polygons, flood fill, translation, rotation, scaling, clipping etc.
Even though these properties were supported, it was difficult to render 2D graphics
cannot be. Very difficult to get a 3Dimensional object. Even the effects like lighting,
shading cannot be provided.
So, we go for Eclipse software.
Proposed System:
3. With OpenGL, we can draw a small set of geometric primitives such as points, lines
and polygons etc.
12
CGV Lab Mini Project “Airplane Crash”
This little plane is ideal for flybys, flight simulators, and other 3D programes. Position,
direction, and speed are the three qualities of a plane. The position is essentially a dot.
The orientation is determined by three UNIT vectors:
(1) forward, which describes which direction is ”up” to someone sitting in the plane,
(2) up, which is a vector perpendicular to forward and describes which direction is ”up”
to someone sitting in the plane, and
(3) right, which is really just the cross product of forward and up that we store to
simplify most of the calculations.
13
CGV Lab Mini Project “Airplane Crash”
Examples in 2D graphics:
Most common geometric transformations that keep the origin fixed are linear,
including rotation, scaling, shearing, reflection, and orthogonal projection; if an affine
transformation is not a pure translation it keeps some point fixed, and that point can be
chosen as origin to make the transformation linear. In two dimensions, linear
transformations can be represented using a 2×2 transformation matrix.
14
CGV Lab Mini Project “Airplane Crash”
CHAPTER 5
FUNCTIONS USED
In this chapter we will study the Inbuilt and User-defined functions used to build Airplane
Crash.
glBegin:
Delimits the vertices of a primitive or a group of like primitives.
glEnd:
Delimits the vertices of a primitive or a group of like primitives.
glClear:
Clears buffers to assigned values.
glClearColor:
Specifies clear values for the background color.
glFlush:
Forces execution of openGL function quickly at once.
glColor3f:
Specifies RGB color values for primitives.
glVertex2f:
Specifies co-ordinates (x, y) values for the vertex position.
15
CGV Lab Mini Project “Airplane Crash”
glutDisplayFunc:
Specifies the function that is called whenever the contents of the window need to be redrawn.
glutPostRedisplay:
Marks the current window as needing to be redrawn. At the next opportunity, the call-back
function registered by glutDisplayFunc () will be called.
glutInitDisplayMode:
Requests a display with the properties in arguments.
glutMainLoop:
Enters the GLUT processing loop, never to return.
glutCreateWindow:
Creates new window for displaying the frame buffer contents.
glutInitWindowSize:
Specifies the initial height and width, in pixels of the window on the screen.
glutInitWindowPosition:
Specifies the top-left corner of the window measured in pixels, from the top left corner of the
screen.
void glClearColor (int red, int green, int blue, int alpha):
16
CGV Lab Mini Project “Airplane Crash”
This function is used to clear the colour of the screen. The 4 values that are passed as
arguments for this function are (RED, GREEN, BLUE, ALPHA) where the red green and
blue components are taken to set the background colour and alpha is a value that specifies
depth of the window. It is used for 3D images.
glutKeyboardFunc sets the keyboard call-back for the current window. When a user types
into the window, each key press generating an ASCII character will generate a keyboard call-
back. The key call-back parameter is the generated ASCII character. The x and y call-back
parameters indicate the mouse location in window relative coordinates when the key was
pressed. When a new window is created, no keyboard call-back is initially registered, and
ASCII key strokes in the window are ignored. Passing NULL to glutKeyboardFunc disables
the generation of keyboard call-backs. where func is the new keyboard call-back function.
glutKeyboardFunc sets the keyboard call-back for the current window.
When a user types into the window, each key press generating an ASCII character will
generate a keyboard call-back. The key call-back parameter is the generated ASCII character.
The x and y call-back parameters indicate the mouse location in window relative coordinates
when the key was pressed. When a new window is created, no keyboard call-back is initially
registered, and ASCII key strokes in the window are ignored. Passing NULL to
glutKeyboardFunc disables the generation of keyboard call- backs.
17
CGV Lab Mini Project “Airplane Crash”
void glMatrixMode (GLenum mode): where mode Specifies which matrix stack is
the target for subsequent matrix operations. Three values are accepted: GL_MODELVIEW,
GL_PROJECTION, and GL_TEXTURE.
The initial value is GL_MODELVIEW. glMatrixMode sets the current matrix mode. mode
can assume one of three values:
GL_MODELVIEW Applies subsequent matrix operations to the model view matrix stack.
GL_PROJECTION Applies subsequent matrix operations to the projection matrix stack.
Viewport width and height are silently clamped to a range that depends on the
implementation. To query this range, call glGetInteger with argument
GL_MAX_VIEWPORT_DIMS.
void glutInit (int *argcp, char **argv): glutInit will initialize the GLUT library and
negotiate a session with the window system. During this process, glutInit may cause the
termination of the GLUT program with an error message to the user if GLUT cannot be
properly initialized. Examples of this situation include the failure to connect to the window
system, the lack of window system support for OpenGL, and invalid command line options.
glutInit also processes command line options, but the specific options parse are window
system dependent.
18
CGV Lab Mini Project “Airplane Crash”
glutReshapeFunc sets the reshape call-back for the current window. The reshape call-back is
triggered when a window is reshaped. A reshape call-back is also triggered immediately
before a window's first display call-back after a window is created or whenever an overlay for
the window is established. The width and height parameters of the call-back specify the new
window size in pixels. Before the call-back, the current window is set to the window that has
been reshaped.
If a reshape call-back is not registered for a window or NULL is passed to glutReshapeFunc
(to deregister a previously registered call-back), the default reshape call-back is used. This
default call-back will simply.
void glutMainLoop(void):
glutMainLoop enters the GLUT event processing loop. This routine should be called at most
once in a GLUT program. Once called, this routine will never glutPostRedisplay ():
glutPostRedisplay, glutPostWindowRedisplay — marks the current or specified window as
needing to be redisplayed.
19
CGV Lab Mini Project “Airplane Crash”
It acts as the front end of the project. It is used to display the Rubik’s Cube on the window
screen by calling colorcube () functions.
CHAPTER 6
IMPLEMENTATION
SNAPSHOTS
This chapter includes the snapshots of various cube rotations seen in our project.
20
CGV Lab Mini Project “Airplane Crash”
21
CGV Lab Mini Project “Airplane Crash”
22
CGV Lab Mini Project “Airplane Crash”
23
CGV Lab Mini Project “Airplane Crash”
CHAPTER 8
This chapter includes our final results, conclusion and the future scope of our project.
Using simple flight dynamics, restricted terrain, and objects, this research successfully
created a virtual reality flight simulator to imitate aeroplane flight. It provides a breath taking
view of flying in mid-air. Because the actual aeroplane flight dynamics were not incorporated
into the created programme, the virtual reality flight simulator was not a complete and
powerful flight simulator.
To put it another way, a virtual reality flight simulator, which is a relatively new technology
for virtual environments, allows users to interact with the computer-generated world. A
downside of this virtual reality flight simulator is the multiple motions required for a typical
flight (joystick, pedal, button, etc.); it still lacks a better facility to deliver an experience that
is comparable to that of a genuine flight. To deliver a better experience, it should be a semi-
portable device. The next stage will contain the plane’s complicated flight dynamics, as well
as richer terrains and more realistic plane objects.
24
CGV Lab Mini Project “Airplane Crash”
REFERENCE
[1] F.S. Hill Jr: “COMPUTER GRAPHICS USING OPENGL, 2nd EDITION”.
[3] Donald Hearn and Pauline baker: “COMPUTER GRAPHICS” C-Version,2nd edition,
Pearson Education.
[5] Abraham Silber Schatz, Henry F. Korth and S. Sudarshan “Sixth Edition Database
System Concepts released”.
[6] https://www.OpenGL.com
[7] https://www.swiftlesstutorials.com
[8] https://www.angelfire.com
25
CGV Lab Mini Project “Airplane Crash”
26