Professional Documents
Culture Documents
BELAGAVI-590018, KARNATAKA
BACHELOR OF ENGINEERING
IN
Certificate
This is to certify that the Mini Project Work entitled “Graphical simulation of a Ship using Open GL”
carried out by ANISH BHAT(1SG19CS007) and ABHIJITH Y L(1SG19CS002), bonafide students of
Sapthagiri College of Engineering, in partial fulfillment for the award of Bachelor of Engineering degree
in Computer Science and Engineering of Visvesvaraya Technological University, Belagavi during the
academic year 2021-2022. It is certified that all corrections/suggestions indicated have been incorporated in
the report. The project report has been approved as it satisfies the academic requirements in respect of CG
Laboratory with Mini Project (18CSL67) prescribed for the said Degree.
EXTERNAL EXAMINATION
1.___________________________ _________________________
2.___________________________ _________________________
ACKNOWLEDGEMENT
The satisfaction and euphoria that accompany the completion of any task would be incomplete
without the mention of the people who made it possible, whose constantguidance and encouragement
ground my efforts with success.
We consider it a privilege to express our gratitude and respect to all those who guided us in
completion of this project.
We are grateful to our Principal Dr. H Ramakrishna, Sapthagiri College of Engineering, who
patronized throughout our career & for the facilities provided to carry outthis work successfully.
It’s a great privilege to place on record our deep sense of gratitude to our beloved HOD Dr.
Kamalakshi Naganna of Computer Science & Engineering, who patronized throughout our career &
for the facilities provided to carry out this work successfully.
We are also grateful to our mini project Guides Prof. Chaithra, Associate Professor & Mrs.
Swetha B.N., Assistant Professor of CSE department for their invaluable support and guidance.
We would also like to thank the teaching and non-teaching staff members who have helped us
directly or indirectly during the project preparation.
Lastly but most importantly we would like thank our family and friends for their co- operation
and motivation to complete this project successfully.
I
ABSTRACT
This project demonstrates a simple simulation of a ship in different environments. Here the different
times of day are represented with different colors for background and lighting. We have also provided
a movement operation for the ship with an ability to shoot projectiles from any given position.
Here we use the keyboard as an input device. Keyboard events are generated when the mouse is
in the window and one of the keys is pressed or released. The GLUT function glutKeyboardFunc
is the callback for events generated by pressing the key. When it occurs the ASCII code for
the key that generated the event and the location of the mouse are returned. All the keyboard
callbacks are registered in a single callback function, such as the following:
glutKeyboardFunc(keyboard);
The callback is specified in GLUT by the following function call:
glutDisplayFunc(display);
It is invoked when GLUT determines that the window should be redisplayed.
II
TABLE OF CONTENTS
2. Requirement Specification 4
2.1 Functional Requirements 4
2.2 Non-Functional Requirements 4
2.2.1 Dependability
2.2.2 Availability
2.2.3 Reliability
2.2.4 Safety
2.2.5 Security
2.3 Details Of The Software 5
2.3.1 Microsoft Visual C++
2.3.2 Opengl And Glut
2.4 Software Requirements 6
2.5 Hardware Requirements 6
3. Design 7
4. Implementation 9
4.1 User Defined Functions 9
4.2 Built In Functions 10
5. Testing 12
6. Snapshots 13
7. Conclusion 17
Bibliography 18
III
LIST OF FIGURES
IV
Graphical simulation of a Ship
CHAPTER 1
INTRODUCTION
The Computer Graphics is one of the most effective and commonly used methods to
communicate the processed information to the user. It displays the information in the form of graphics
objects such as pictures, charts, graphs and diagram instead of simple text.
Computer graphics today is largely interactive: The user controls the contents structure, and
appearance of objects and their displayed images by using input devices, such as a keyboard, mouse,
or touch-sensitive panel on the screen.
The image enhancement deals with the improvement in the image quality by eliminating noise
or by increasing image contrast. Pattern detection and recognition deals with the detection and
clarification of standard patternsand finding deviations from these patterns .The optical character
recognition (OCR) technology is an practical example for pattern detection & recognition. Scene
analysis deals with the recognition and reconstruction of 3D model of scene from several 2D images.
The applications of computer graphics in some of the major areas are as follows
1. Display of information.
2. Design.
3. Simulation and Animation.
4. User interfaces.
Blending:
The project uses blending to make objects appear transparent.
Transformations:
A transformation is a function that takes a point or vector and maps that point or vector into
another point or vector. In this application the transformation is used to make the plane to rotate in all
3 axis.
Bitmap Character:
OpenGL supports two kinds of texts: bitmap character and stroke character. Bitmap characters are
basically 2D font without thickness. In this application bitmap character is used to display the texts.
CHAPTER 2
REQUIREMENT SPECIFICATION
A software requirement definition is an abstract description of the services which the system should
provide, and the constraints under which the system must operate. It should only specify the external
behavior of the system.
2.2.2 Availability:
The ability of the system to deliver services when requested. There is no error in the program
while executing the program.
2.2.3 Reliability:
The ability of the system to deliver services as specified. The program is compatible with all
types of operating system without any failure.
2.2.4 Safety:
The ability of the system to operate without catastrophic failure. This program is user friendly
and it will never effects the system.
2.2.5 Security:
The ability of the system to protect itself against accidental or deliberate intrusion.
GLUT is the OpenGL Utility Toolkit, a window system independent toolkit for writing
OpenGL programs. It implements a simple windowing application programming interface (API)for
OpenGL. GLUT makes it considerably easier to learn about and explore OpenGL programming.
GLUT provides a portable API so you can write a single OpenGL program that works across all PC
and workstation OS platforms.
CHAPTER 3
DESIGN
Data flow design is as shown below - covering the flow of the data in the system. It describes
the relation between user input and the system behavior.
CHAPTER 4
IMPLEMENTATION
To implement the Current system we have used different functions of our project which are as follows:
➢ frontscreen ()
Print the introduction screen showing project name and group members names
➢ Drawarc(float sa,float ea,float cx,float cy,float rd)
To draw sun and moon using arcs
➢ cloud(int m, int n)
To draw clouds.
➢ ship(float x)
To simulate ship object.
➢ water ()
To simulate water on the ocean
➢ mountain ()
To simulate mountains behind the ship
➢ flag ()
To display flag on the ship
➢ crackers ()
To simulate rocket ejected from the ship
➢ plane ()
To simulate plane in the sky which appears at regular intervals.
It has a certain speed to give a frame of reference for the ship
• voidglutMainLoop (void);
- It enters the GLUT event processing group. This routine should be called at most once in a
GLUT program. Once called, this routine will never return. It will call as necessary any
callbacks that have been registered.
• voidglutPostRedisplay (void);
- It marks the current window as needing to be redisplayed.
CHAPTER 5
TESTING
CHAPTER 6
SNAPSHOTS
CHAPTER 7
CONCLUSION
The development of the project is not an easy process as it involves lot of challenges in different
stages of software analysis, design, coding and testing.
Having understood the requirements properly and implementing the solutions as per the
expectation as brought to the closure of the project. We have tried our best to make this project very
realistic, so that the user does not face any trouble when switching over from any real life graphics
project to this highly useful one.
We consider this an entry into the world of visualization and simulation and look forward to work
on more interesting projects in future. Throughout the duration of this project we learnt new OpenGL
functions which we were not familiar with prior to us starting this endeavor. We learnt how to create
our own functions to make objects work the way we want to
Finally we would like to say that while working on this project we learnt collaborating to get things
done on time, and creating a fully working project within a deadline made us improve our time
management skills. We look forward to making more projects like these in future.
BIBILOGRAPHY
Reference Books
[1] “Interactive Computer Graphics- A Top-Down Approach Using OpenGL” By
Edward Angel
[2] “Computer Graphics under C” By Yeshwant Kanetkar
[3] The openGL programming guide – The red book
[4] OpenGL 4.6 Reference Guide Khronos Group(You?) | 2018
[5] Learn OpenGL Learn modern OpenGL graphics programming in a step-by-step fashion.
Joey de Vries(You?)|2020
Websites
❖ www.opengl.org
❖ www.google.co.in(OpenGLprojects)
❖ www.wikipedia.com
❖ https://www.khronos.org/opengles/resources
❖ https://people.ece.ubc.ca/leei/478/resources.html
❖ https://riggaroo.dev/resources-for-learning-opengl-an-android-developers-guide/
❖ http://www.opengl-tutorial.org/miscellaneous/useful-tools-links/