CGV Final1

Download as pdf or txt
Download as pdf or txt
You are on page 1of 21

VISVESVARAYA TECHNOLOGICAL

UNIVERSITY BELAGAVI

A MINI PROJECT REPORT ON

Toll Collecting Using OpenGL


IN
COMPUTER SCIENCE & ENGINEERING
By

AJAY N 4AL19CS005
AKHILESH HERKAL 4AL19CS006

Under the Guidance


of

Mrs. Pranitha
Assistant Professor

DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING


ALVA’S INSTITUTE OF ENGINEERING AND
TECHNOLOGY MOODBIDRI-574225, KARNATAKA
2021–2022
ALVA’S INSTITUTE OF ENGINEERING AND TECHNOLOGY
MIJAR, MOODBIDRI D.K. -574225
KARNATAKA

DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING

CERTIFICATE
This is to certify that the Mini Project entitled Toll Collecting Using OpenGL has been successfully
completed by

AJAY N 4AL19CS005
AKHILESH HERKAL 4AL19CS006

the bonafide students of Department of Computer Science & Engineering, Alva’s Institute
of Engineering and Technology in DEPARTMENT OF COMPUTER SCIENCE &
ENGINEERING of the VISVESVARAYA TECHNOLOGICAL UNIVERSITY, BELAGAVI
during the year 2021–2022. It is certified that all corrections/suggestions indicated for Internal
Assessment have been incorporated in the report deposited in the departmental library. The Mini
project report has been approved as it satisfies the academic requirements in respect of Mini
Project work prescribed for the Bachelor of Engineering Degree.

Mrs. Pranitha Dr Manjunath Kotari


Mini Project Guide HOD CSE

External Viva

Name of the Examiners Signature with Date

1.

2.
ALVA’S INSTITUTE OF ENGINEERING AND TECHNOLOGY
MIJAR, MOODBIDRI D.K. -574225
KARNATAKA

DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING

Declaration
We,
AJAY N
AKHILESH HERKAL

hereby declare that the dissertation entitled, Alva’s Event Management is completed and
written by us under the supervision of my guide Mrs. Pranitha, Assistant Professor,
Department of Computer Science and Engineering. Alva’s Institute of Engineering And
Technology, Moodbidri, DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING
of the VISVESVARAYA TECHNOLOGICAL UNIVERSITY, BELAGAVI during the
academic year 2021-2022.The dissertation report is original and it has not been submitted
for any other degree in any university.

AJAY N 4AL19CS005
AKHILESH HERKAL 4AL19CS006
ACKNOWLEDGEMENT

The satisfaction and euphoria that accompany a successful completion of any task would
be incomplete without the mention of people who made it possible, success is the epitome
of hard work and perseverance, but steadfast of all is encouraging guidance.

So, with gratitude we acknowledge all those whose guidance and encouragement
served as beacon of light and crowned the effort with success.

The selection of this mini project work as well as the timely completion is mainly
due to the interest and persuasion of our mini project coordinator Mrs. Pranitha,
Assistant Professor, Department of Computer Science & Engineering. We will remember
his contribution forever.

We sincerely thank Dr. Manjunath Kotari, Professor and Head, Department of


Computer Science & Engineering who has been the constant driving force behind the
completion of the project.

We thank our beloved Principal Dr.Peter Fernandes, for his constant help and
support throughout.

We are indebted to Management of Alva’s Institute of Engineering and


Technology, Mijar, Moodbidri for providing an environment which helped us in
completing our mini project.

Also, we thank all the teaching and non-teaching staff of the Department of
Computer Science & Engineering for the help rendered.

AJAY N 4AL19CS005
AKHILESH HERKAL 4AL19CS006

i
ABSTRACT

The main idea behind this project is to display the concept of a toll collecting
booth with computer graphics. This graphics package is based on the OpenGL library
functions. The programming language used here is C using OpenGL libraries.

The idea behind this project is to display the concept of toll collection booths
through computer graphics. This project will include a toll collecting booth where as soon
as the car comes the barrier is imposed. This barrier will then be lifted by the user.

There will be a two-way path in at both ways we have at toll collecting booth for
both directions. To open the left side barrier we use to press ‘L|l’ key, as soon as the key
is pressed the left side car will move. And in the same way, we have ‘R|r’ key to open the
barrier and allow the car to move further.

ii
TABLE OF CONTENTS

Chap no Description Page No


Acknowledgement i
Abstract ii
Contents iii
List of Snapshots iv
1 INTRODUCTION 1-2
2 REQUIREMENT ANALYSIS 3
2.1 Project Requirements
2.2 Software Requirements
2.3 Hardware Requirements
2.4 Languages Used
3 PROJECT DESIGN 4-5
3.1 Module Description
3.2 Flow Diagram
4 IMPLEMENTATION 6-8
4.1 Code
4.2 Glut Functions
4.3 Steps Involved
5 RESULT 9-12
6 CONCLUSION 13
REFERENCES

iii
List of Snapshots

Page No
1. Snapshot 5.1.1 9
2. Snapshot 5.1.2. 10
3. Snapshot 5.1.3 10
4. Snapshot 5.1.4 11
5. Snapshot 5.1.5 11
6. Snapshot 5.1.6 12

iv
Toll Collecting Using OpenGL

Chapter 1
INTRODUCTION
This chapter gives brief introduction about computer graphics, the features of glew
and glut and binary search tree.

1.1 COMPUTER GRAPHICS

Computers have 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, and so it is not surprising to find the use of computer graphics so widespread.
Although early applications in engineering and science had to rely on expensive and
cumbersome equipment, advances in computer technology have made interactive
computer graphics a practical tool. Computer graphics are pictures and films created using
computers. Usually, the term refers to computer generated image data created with the
help of specialized graphical hardware and software.

1.2 OPENGL

Open Graphics Library (OpenGL) is a cross-language, cross-platform application


programming interface (API) for rendering 2D and 3D vector graphics. The API is
typically used to interact with a graphics processing unit (GPU), to achieve hardware-
accelerated rendering. Modern OpenGL has raised the entry threshold for computer
graphics programming.

1.3 GLUT

The OpenGL Utility Toolkit (GLUT) is a library of utilities for OpenGL programs, which
primarily perform system-level I/O with the host operating system. Functions performed
include window definition, window control, and monitoring of keyboard and mouse input.
Routines for drawing a number of geometric primitives (both in solid and wireframe
mode) are also provided, including cubes, spheres and the Utah teapot. GLUT also has
some limited support for creating pop-up menus.

Dept. of CSE, AIET, MOODBIDRI Page 1


Toll Collecting Using OpenGL

1.4 FREEGLUT

FreeGLUT is a free-software/open-source alternative to the OpenGL Utility Toolkit


(GLUT) library. GLUT (and hence FreeGLUT) allows the user to create and manage
windows containing OpenGL contexts on a wide range of platforms and also read the
mouse, keyboard and joystick functions. FreeGLUT is intended to be a full replacement
for GLUT, and has only a few differences.

1.5 GLEW

The OpenGL Extension Wrangler Library (GLEW) is a cross-platform opensource C/C++


extension loading library. GLEW provides efficient run-time mechanisms for determining
which OpenGL extensions are supported on the target platform. OpenGL core and
extension functionality are exposed in a single header file.

Dept. of CSE, AIET, MOODBIDRI Page 2


Toll Collecting Using OpenGL

Chapter 2
REQUIREMENT ANALYSIS
2.1 Project Requirements
The package is designed such that users with a computer having minimum configuration
can also use it. It doesn’t require many complex graphics packages.
The package requires simple in-built functions found in the Freeglut library. Some
basic functions found in the graphics package of Codeblocks compiler have also been
used.

2.2 Software Requirements


The minimum requirements are
 Windows operating system.
 Codeblocks Version 17.12.
 Freeglut 3.0.0.

Hardware Requirements
The minimum requirements are
 A computer with 333 MHz processor.
 32 MB SD/DDR RAM.
 100 MB of Hard disk space.
 Monitor resolution - A color monitor with a minimum resolution of 640*480.

2.3 Languages Used

 Opengl Functions
 Data structure in cpp.
 Object Oriented Concept
 C++

Dept. of CSE, AIET, MOODBIDRI Page 3


Toll Collecting Using OpenGL

Chapter 3
PROJECT DESIGN
The idea behind this project is to display the concept of toll collection booths
through computer graphics. This project will include a toll collecting booth where as soon
as the car comes the barrier is imposed. This barrier will then be lifted by the user. There
will be two way path in at both way we have at toll collecting booth for both direction. To
open the left side barrier we use to press ‘L|l’ key, as soon as the key is pressed the left
side car will move. And in the same way, we have ‘R|r’ key to open the barrier and allow
the car to move further. Here we also we can increase or decrease the speed of the cars by
using proper keys.

3.1 Module Description


MAIN FUNCTION: Main is a function from which execution of the program ill start. It
initializes the window of size 1000*1000 pixels. And also call various functions defined in the
program, also includes a menu which intern calls the related functions (such as my menu, sub-
menu, etc…).

MYINIT FUNCTION: This function is used to convert one coordinate system to another


coordinate system. We used the GL_MatrixMode(GL_PROJECTION) and glLoadIdentity() in
this function.

MENU FUNCTION: It creates the main and the sub-menus, whereas the main menu is to
“Quit, increase the size and decrease size” of the objects. And sub-menus are used for color.
The menu is assigned to mouse click when the mouse (LEFT or RIGHT) button is pressed the
menu will appear and action is performed.

MOUSE FUNCTION: This is an event-driven function which is used to select the objects.


Here in this project, we have used this mouse function to select the paint objects, specified in a
specific region.

Dept. of CSE, AIET, MOODBIDRI Page 4


Toll Collecting Using OpenGL

3.2 Flow Diagram

Fig 3.1 Flow Diagram of Toll Collecting System Using OpenGL

This flow Diagram shows the represents the display, keyboard, init, reshape, and mov. In under display
there are several subsections, they are welcome, frontscreen and color section. In under Welcome
section there are drawstring, drawstring1, drawstring2.

Dept. of CSE, AIET, MOODBIDRI Page 5


Toll Collecting Using OpenGL

Chapter 4
IMPLEMENTATION
This section gives information regarding the user defined functions and GLUT
functions used in the project.
4.1 Code
// car3
//color();
color();
glBegin(GL_QUADS);
glVertex2f(ax + 140, cy1);
glVertex2f(ax + 190, cy2);
glVertex2f(ax + 190, cy3);
glVertex2f(ax + 140, cy4);
glEnd();
glBegin(GL_QUADS);
glVertex2f(ax + 130, cy5);
glVertex2f(ax + 200, cy6);
glVertex2f(ax + 200, cy7);
glVertex2f(ax + 130, cy8);
glEnd();
glBegin(GL_QUADS);
glVertex2f(ax + 140, cy9);
glVertex2f(ax + 190, cy10);
glVertex2f(ax + 190, cy11);
glVertex2f(ax + 140, cy12);
glEnd();
//wheel
glBegin(GL_QUADS);
glColor3f(0.0, 0.0, 0.0);
glVertex2f(ax + 135, cy13);//lft cr btm
glVertex2f(ax + 140, cy14);//lt wel

Dept. of CSE, AIET, MOODBIDRI Page 6


Toll Collecting Using OpenGL

glVertex2f(ax + 140, cy15);


glVertex2f(ax + 135, cy16);
glEnd();
glBegin(GL_QUADS);
glColor3f(0.0, 0.0, 0.0);
glVertex2f(ax + 190, cy17);//lft cr btm rt wel
glVertex2f(ax + 195, cy18);
glVertex2f(ax + 195, cy19);
glVertex2f(ax + 190, cy20);
glEnd();
glBegin(GL_QUADS);
glColor3f(0.0, 0.0, 0.0);
glVertex2f(ax + 135, cy21);//left cr top
glVertex2f(ax + 140, cy22);//lft wel
glVertex2f(ax + 140, cy23);
glVertex2f(ax + 135, cy24);
glEnd();
glBegin(GL_QUADS);
glColor3f(0.0, 0.0, 0.0);
glVertex2f(ax + 190, cy25);//lft car top rt wel
glVertex2f(ax + 195, cy26);
glVertex2f(ax + 195, cy27);
glVertex2f(ax + 190, cy28);
glEnd();

Dept. of CSE, AIET, MOODBIDRI Page 7


Toll Collecting Using OpenGL

4.2 GLUT Functions


 glBegin(): Initiates a new primitive of type mode and starts the collection of
vertices. Values of mode include GL_POINTS, GL_LINES and GL_POLYGON.
 glEnd(): Terminates a list of vertices
 glutInit(&argc,argv): Initializes GLUT and processes any command line
arguments(for x, this would be options like display and geometry).
 glutInit(): should be called before any other GLUT routine.
 glutInitDisplayMode(GLUT_SINGLE|GLUT_RGB): Specifies whether to use
an RGBA or color_index model. You can also specify whether you want a single
or double buffered window. If you are working in color_index mode,you will want
to load certain colors into the color map use glutSetColor() to do this. Finaly, you
can use this routine to indicate you want the window to have an associated depth,
stencil, and/or accumulation buffer.
 glutCreatewindow(“Binary Search Tree”): Creates a window with an openGL
context.it returns a unique identifier for the new window. Until glutMainLoop() is
called the window is not displayed.
 glutInitWindowSize(x_size,y_size): Specifies the size in pixels of your window.
 glutInitWindowPosition(int x,int y): Specifies the screen location for the
upper_left corner of your window.
 glutDisplayFunc(display): It is the first and most important event callback
function you will see. Whenever GLUT determines the contents of window,
sometimes you will have to call glutPostRedisplay(void), which gives
glutMainLoop() a nudge to call the registered display callback at its next
opportunity.

4.3 Steps Involved


1. In welcome page, press 1 for next page
2. In frontscreen page, press 2 for next page
3. Press the keys that displays on the screen which varies for each car.

Dept. of CSE, AIET, MOODBIDRI Page 8


Toll Collecting Using OpenGL

Chapter 5
RESULT

This section includes the snapshots of the possible test cases of the project and its
details.

5.1 Snapshots

Fig 5.1.1 Input Screen

This is the welcome page as shown in Fig 5.1.

Dept. of CSE, AIET, MOODBIDRI Page 9


Toll Collecting Using OpenGL

Fig 5.1.2 Front Screen Window

The page shows the front screen which is having the details of the student names
and professor name of under the guidance of implementation.

Fig 5.1.3 Display of Toll Verificaton

The page shows Car BMW and NANO is paying toll

Dept. of CSE, AIET, MOODBIDRI Page 10


Toll Collecting Using OpenGL

Fig 5.1.4 Display of Toll Verification

This page shows that After paying toll car BMW went and the next car is waiting to pay
the toll, After paying the toll right-side barrier opened and NANO car passing.

Fig 5.1.5 Display of Toll Verification

This page shows as soon as we pay the toll the barriers will open and cars will move from both
sides.

Dept. of CSE, AIET, MOODBIDRI Page 11


Toll Collecting Using OpenGL

Fig 5.1.6 Display of Toll Verification

This page shows that after all the implementation there is again a continues assemble of vehicle
can be viewed.

Dept. of CSE, AIET, MOODBIDRI Page 12


Toll Collecting Using OpenGL

Chapter 6
CONCLUSION

There will be a two-way path in at both ways we have at toll collecting booth for
both directions. Toll Collection technologies and its impacts on transport sectors in
developing countries like Bangladesh. This paper initially includes the identified relevant
technologies of ETC that used in many developed countries. Toll collection systems
provide a great advantage over the conventional systems. Even though there is some
privacy concerns, Electronic toll collection systems have far greater advantages when it
comes to increase revenue, operating and economic cost and improved air quality.

Page 13
Dept. of CSE, AIET, MOODBIDRI
REFERENCES

Textbooks Referred

 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

Links Referred

 https://learnopengl.com/Getting-started/OpenGL

 https://www.geeksforgeeks.org/binary-search-tree-set-1-search-and-
insertion/

You might also like