0% found this document useful (0 votes)
4 views22 pages

CG project report2_merged

Download as pdf or txt
Download as pdf or txt
Download as pdf or txt
You are on page 1/ 22

VISVESVARAYA TECHNOLOGICAL UNIVERSITY

JNANASANGAMA, BELAGAVI - 590018

A MINI PROJECT REPORT


On
TRAIN ARRIVAL AND DEPARTURE

Submitted in partial fulfillment for requirement for the award of the degree of

BACHELOR ENGINEERING
IN
COMPUTER SCIENCE AND ENGINEERING

BY

NISHA BALLAL 4KV19CS054


PAVARAJ B U 4KV19CS058

DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING


K.V.G. COLLEGE OF ENGINEERING SULLIA, D.K. - 574 327
2021-2022
K.V.G. College of Engineering, Sullia, D.K. 574 327
(AFFILIATED TO VISVESVARAYA TECHNOLOGICAL UNIVERSITY, BELAGAVI)

DEPARTMENT OF COMPUTER SCIENCE AND


ENGINEERING

CERTIFICATE
Certified that the mini project work entitled “TRAIN ARRIVAL AND DEPARTURE”
carried out by,
NISHA BALLAL 4KV19CS054
PAVANRAJ B U 4KV19CS058

In partial fulfillment for the award of BACHELOR OF ENGINEERING in COMPUTER


SCIENCE AND ENGINEERING of the VISVESVARAYA TECHNOLOGICAL
UNIVERSITY, BELAGAVI during the year 2021-22. It is certified that all
corrections/suggestions indicated for Internal Assessment of Computer Graphics Laboratory
with Mini Project have been incorporated in this Report and has been approved as it satisfies the
academic requirement in respect of Mini Project work prescribed for the said Degree.

Prof. SOORAJ PRASAD M H Prof. SINDHU VENKATESH


Assistant Professor Assistant Professor
CS&E, KVGCE, Sullia CS&E, KVGCE, Sullia

Dr. UJWAL U.J


Head of the Department
CS&E, KVGCE, Sullia

Name of the Examiners Signature with Date


1.
2.
ACKNOWLEDGEMENT

We are grateful to our institution K.V.G COLLEGE OF ENGINEERING, SULLIA with its ideas
and inspiration for having provided us the facilities that have made this project a success.

We are deeply indebted to our guides Prof. SOORAJ PRASAD M H, Assistant Professor and
Prof. SINDHU VENKATESH, Assistant Professor, Department of Computer Science &
Engineering taking pain in the successful completion of this mini project.

We express our earnest gratification to H.O.D, Dept. of Computer Science & Engineering Dr.
UJWAL U J, who helped us in getting things done and were always inspirational which provided
us the impetus to complete this project successfully.

We express our heart full thanks to the Principal, Dr. SURESHA V for providing congenial to
work on it.

We are deeply indebted to late Dr. KURUNJI VENKATRAMANA GOWDA, President of


AOLE, for having provided an environment with all facilities that helped us in completing this
project.

We express our heart full thanks to the General Secretary, Dr. RENUKA PRASAD K V for
providing congenial to work on it. We would like to extend our thanks to all the teaching and
non-teaching staff members and the students of C.S&E department for their help, advice and
support.
ABSTRACT

The Computer Graphics mini project called “Train Arrival and Departure Simulation” is a simple
project built using OpenGL, where railway station scenario is shown. The tarin will travel in
different modes of environment like day and night modes when you press the keyboard key. This
mini project is implemented using inbuilt functions of OpenGL and designed these objects which
we have used in the project. The project is developed in two-dimensional mode. The controls
will be specified and these will be provided from the keyboard and some of the options using
menu.
TABLE OF CONTENTS

CHAPTER. No TITLE PAGE.NO

1 INTRODUCTION 1
2 REQUIREMENT SPECIFICATION 2-3
3 SYSTEM DESIGN 4
4 SYSTEM IMPLEMENTATION 5-8
5 SNAPSHOTS 9-12
6 USER MANUAL 13
7 CONCLUSIONS 14
BIBLIOGRAPHY 15
TRAIN SIMULATION 2021-22

CHAPTER 1
INTRODUCTION

Train arrival and departure is a newly designed computer graphics mini project. In this mini
project, there will be objects like train, signal, and a place called “railway station”. There will be
a train in which it will start arriving at the railway station when the signal light “green” is turned
on. It will stop at the railway station when the red light is turned on and the train will not move
from the railway station till the user displays the green light in the traffic signal when the green
light is turned on then the train will start to depart from the railway station. In this project, there
will be night mode and day mode. The project is a bit difficult to implement since there are lots
of objects in this project a train, railway station, signal light these are the main objects and some
more in the project. The train when the user displays the green signal on the traffic signal the
train will start arriving at the station. When the train approaches the station then the red signal
will be displayed then the train will stop at the railway station and then after displaying the green
light, the train will depart from the station. By pressing the right button in the mouse, you can
see a menu on the screen. Which containing some options and if you click the left button of the
mouse, we can quit the program. In the night mode, a comet movement is also designed by the
controls provided.

1.1 AIM

The project aims to show a graphical representation of railway station scenario using OpenGL
functions with variety of objects like train, railway station, railway track, sun, stars, plane,
moon etc.

DEPARTMENT OF CSE, KVGCE, SULLIA 1


TRAIN SIMULATION 2021-22

CHAPTER 2
REQUIREMENT SPECIFICATION
A requirement specification is a collection of all requirements that are to be imposed on the
design and verification of the product.

2.1 Details of Software


2.1.2 MICROSOFT VISUAL STUDIO 2008
Microsoft Visual Studio is an integrated development environment (IDE) from Microsoft. It is
used to develop computer programs, as well as websites, web apps, web services and mobile
apps. 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 (the code completion component) 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 code profiler, designer for building GUI applications, web designer, class
designer, and database schema designer. It accepts plug-ins that expand the functionality at
almost every level including adding support for source control systems (like Subversion and Git)
and adding new toolsets like editors and visual designers for domain-specific languages or
toolsets for other aspects of the software development lifecycle.

2.1.2 OpenGL
OpenGL (Open Graphics Library) is a software interface to graphics hardware. The interface
consists of over 250 different function calls which can be used to draw complex two- and three-
dimensional scenes from simple geometric primitives such as points, lines, and polygons.
OpenGL is an application programming interface offering various functions to implement
primitives, models and images. This offer functions to create and manipulate render lighting,
coloring, viewing the models. OpenGL offers different coordinate system and frames. OpenGL
offers translation, rotation and scaling of objects.

Most of our applications will be designed to access OpenGL directly through functions in three
libraries. They are:

➢ OpenGL Utility Library: 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

DEPARTMENT OF CSE, KVGCE, SULLIA 2


TRAIN SIMULATION 2021-22

repeatedly. The GLU library is available in all OpenGL implementations. Functions in


the GLU library begins with the letters glu.
➢ OpenGL Utility Toolkit (GLUT): This provides the minimum functionality that should
be accepted in any modern windowing system.

2.2 System Requirements


System requirements are the configuration that a system must have in order for a hardware or
software application to run smoothly and efficiently. Failure to meet these requirements can
result in installation problems or performance problems.

2.2.1 Hardware Requirements


• Processor:11th Gen Intel(R) Core (TM) i5-1135G7
• RAM: 8GB
• Device: DESKTOP-UVO056M

2.2.2 Software Requirements


• Operating System: Windows 10
• Programming Language: C/C++
• Graphics Library: glut.h
• Editor: Microsoft Visual Studio 2008

DEPARTMENT OF CSE, KVGCE, SULLIA 3


TRAIN SIMULATION 2021-22

CHAPTER 3
SYSTEM DESIGN
Systems design is the process of defining the architecture, modules, interfaces, and data for a
system to satisfy specified requirements. Systems design could be seen as the application of
systems theory to product development.

main ()

display idle keyboard mouse myinit

traffic_light draw_object exit (0)

draw_circle

plotpixels

draw_pixel

Fig.3.1 Block Diagram

DEPARTMENT OF CSE, KVGCE, SULLIA 4


TRAIN SIMULATION 2021-22

CHAPTER 4

SYSTEM IMPLEMENTATION
Systems implementation is the process of defining how the information system should be built
(i.e., physical system design), ensuring that the information system is operational and used,
ensuring that the information system meets quality standard.

4.1 Modular Description


➢ void declare(): To display Railway Station board.
➢ void draw_pixel( ): Used to draw point.
➢ void draw_circle(): Used to draw circle.
➢ void draw_object(): Used to all the objects.
➢ void traffic_light(): Used to draw traffic light.
➢ void idle(): Used to control speed of moving objects.
➢ void mouse(): Used to give menu driven options.
➢ void keyboardFunc(): Used perform keyboard driven functions .

4.2 OpenGL Functions


➢ glutInit() : interaction between the windowing system and OPENGL is initiated
➢ glutInitDisplayMode() : used when double buffering is required and depth information
is required
➢ glutCreateWindow() : this opens the OPENGL window and displays the title at top of
the window
➢ glutInitWindowSize() : specifies the size of the window
➢ glutInitWindowPosition() : specifies the position of the window in screen co-ordinates
➢ glutKeyboardFunc() : handles normal ascii symbols
➢ glutDisplayFunc() : this handles redrawing of the window
➢ glutMainLoop() : this starts the main loop, it never returns
➢ glVertex2f() : used to set up the points or vertices in two dimensions
➢ glColor3f() : used to render color to faces
➢ glFlush() : used to flush the pipeline
➢ glutPostRedisplay() : used to trigger an automatic redraw of the object
➢ glMatrixMode() : used to set up the required mode of the matrix

DEPARTMENT OF CSE, KVGCE, SULLIA 5


TRAIN SIMULATION 2021-22

➢ glLoadIdentity() : used to load or initialize to the identity matrix

4.3 User Defined Functions

• void declare ():


void declare (char* string)
{
while (*string)
glutBitmapCharacter(GLUT_BITMAP_TIMES_ROMAN_24,
*string++);
}

• void draw_pixel():
void draw_pixel(GLint cx, GLint cy)
{

glBegin(GL_POINTS);
glVertex2i(cx, cy);
glEnd();
}

• void draw_circle():
void draw_circle(GLint h, GLint k, GLint r)
{
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); }

• void idle():
void idle()
{
glClearColor(1.0, 1.0, 1.0, 1.0);

if (light == 0 && (i >= 0 && i <= 1150))


{
i += SPEED / 10;

DEPARTMENT OF CSE, KVGCE, SULLIA 6


TRAIN SIMULATION 2021-22

m += SPEED / 150;
n -= 2;
o += 0.2;
c += 2;
}
if (light == 0 && (i >= 2600 && i <= 3000))
{
i += SPEED / 10;
m += SPEED / 150;
n -= 2;
o += 0.2;
c += 2;
}
if (light == 0)
{
i = i;
m += SPEED / 150;
n -= 2;
o += 0.2;
c += 2;
}
else
{
i += SPEED / 10;
m += SPEED / 150;
n -= 2;
o += 0.2;
c += 2;
}
if (i > 3500)
i = 0.0;
if (m > 1100)
m = 0.0;
if (o > 75)
{
plane = 0;
}
if (c > 500)
{
comet = 0;
}
glutPostRedisplay();
}

• void mouse():
void mouse (int btn, int state, int x, int y)
{
if (btn == GLUT_LEFT_BUTTON && state == GLUT_UP)
exit (0);
}

DEPARTMENT OF CSE, KVGCE, SULLIA 7


TRAIN SIMULATION 2021-22

• void keyboardFunc():
void keyboardFunc(unsigned char key, int x, int y)
{
switch (key)
{
case 'g':
case 'G':
light = 1;
break;
case 'r':
case 'R':
light = 0;
break;
case 'd':
case 'D':
day = 1;
break;
case 'n':
case 'N':
day = 0;
break;
case 't':
case 'T':
train = 1;
i = 0;
break;
};
}

DEPARTMENT OF CSE, KVGCE, SULLIA 8


TRAIN SIMULATION 2021-22

CHAPTER 5
SNAPSHOTS

Fig 5.1 User Manual

Fig 5.2 Railway Station

DEPARTMENT OF CSE, KVGCE, SULLIA 9


TRAIN SIMULATION 2021-22

Fig 5.3 Train arrival

Fig 5.4 Green Light

DEPARTMENT OF CSE, KVGCE, SULLIA 10


TRAIN SIMULATION 2021-22

Fig 5.5 Red Light

Fig 5.6 Aero plane

DEPARTMENT OF CSE, KVGCE, SULLIA 11


TRAIN SIMULATION 2021-22

Fig 5.7 Night Mode

Fig 5.8 Comet

DEPARTMENT OF CSE, KVGCE, SULLIA 12


TRAIN SIMULATION 2021-22

CHAPTER 6
USER MANUAL
This program includes interaction through keyboards.

• r/R - Red light

• g/G - Green light

• d/D -Day

• n/N-Night

• t/T-Train arrive at station

Interaction through mouse

• Right button- Display menu


• Left button- Quit the program

DEPARTMENT OF CSE, KVGCE, SULLIA 13


TRAIN SIMULATION 2021-22

CHAPTER 7

CONCLUSION
Arrival and departure of the train and motion of some objects were included in this project. Some
other options are also provided. You can implement some other objects by keeping the reference
of this according to your requirements to enhance the project. This project can be implemented
using 3D viewing.

DEPARTMENT OF CSE, KVGCE, SULLIA 14


TRAIN SIMULATION 2021-22

BIBLIOGRAPHY
• Donald Hearn & Pauline Baker: Computer Graphics with OpenGL Version,3rd /
4th Edition, Pearson Education,2011
• Edward Angel: Interactive Computer Graphics- A Top-Down approach with
OpenGL, 5th edition. Pearson Education, 2008
• https://www3.ntu.edu.sg/home/ehchua/programming/opengl/CG_Introduction.ht
ml

DEPARTMENT OF CSE, KVGCE, SULLIA 15


TRAIN SIMULATION 2021-22

DEPARTMENT OF CSE, KVGCE, SULLIA 16


TRAIN SIMULATION 2021-22

DEPARTMENT OF CSE, KVGCE, SULLIA 17

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy