Professional Documents
Culture Documents
2020-21
COMPUTER GRAPHICS [18CS62]
Mini Project Report
On
TRAFFIC SIGNAL
SUBMITTED IN PARTIAL FULFILLMENT OF THE REQUIREMENT IN 6TH SEMESTER
COMPUTER GRAPHICS PROJECT WORK (18CS62) OF BACHELOR OF ENGINEERING
IN
By
POOJA U S 4VM18CS030
YASHASWINI M S 4VM18CS048
Prof.AMBIKA
Assistant Professor
Dept. of CSE, VVIET
CERTIFICATE
Certified that the COMPUTER GRAPHICS Mini Project Work entitled “TRAFFIC
SIGNAL” carried out by POOJA US [4VM18CS030] and YASHASWINI MS [4VM18CS048],
bonafide students of VVIET in partial fulfillment for the award of degree Bachelor of
Engineering in COMPUTER SCIENCE and ENGINEERING as prescribed by
VISVESVARAYA TECHNOLOGICAL UNIVERSITY, BELGAUM during the academic
year 2020-21. It is certified that all corrections/suggestions indicated for internal assessment
have been incorporated in the report deposited in the departmental library. The project
report has been approved as it satisfies the academic requirements in respect of mini
project work prescribed for the said degree.
EXTERNAL VIVA
Name of the examiners Signature with date
1.
2.
ACKNOWLEDGEMENT
We would like to thank and express our heartfelt gratitude to God almighty for the
abundant blessings without which this project would not have been successful.
We would like to express our sincere gratitude to Sri. Vasu, Chairman of VVIET,
Mr. Kaveesh Gowda V, Secretary of VVIET and all management members of VVIET, for their
constant support.
We acknowledge and express our sincere thanks to our beloved Principal
Dr. Ravishankar M, VVIET, Mysuru who is the source of inspiration.
We would like to express our deepest sense of gratitude towards Dr. Madhu B K,
Head of the Department, CSE, VVIET, Mysuru for his valuable suggestions, support and
encouragement.
We would like to extend our heartfelt gratitude to Mrs.Ambika, Assistant Professor,
Dept. of CSE, for the valuable guidance and advice. We would also like to thank him for his
guidance and useful suggestions, which helped us in completing the project work on time.
We would also thank all other teaching and non-teaching staffs of the Computer
Science Department who has directly or indirectly helped us in completion of this project.
Our thanks and appreciation also go to our family and friends who have willingly
helped us out with their abilities.
Regards,
POOJA US
Yashaswini MS
ABSTRACT
• Main aim of this Mini Project is to illustrate the concepts and usage of
pre-built functions in OpenGL.
• Simulation of a traffic signal is being done using computer graphics.
• The car built using cubes can be moved using arrow keys and based
on traffic signal light the user can obey the traffic rules.
• We have used input devices like mouse and key board to interact with
program
TABLE OF CONTENTS
Acknowledgement i
Abstract ii
List of Figures 5
1. Introduction
1.1 Aim 1
1.3 Motivation 2
1.4 Application 2
1.5 Advantages 2
Conclusion 31
Future Enhancement 32
References 34
LIST OF FIGURES
4.2 Methodology 16
OpenGL Fundamentals
The figure shown below gives an abstract, high-level block diagram of how OpenGL processes
data. In the diagram, commands enter from the left and proceed through what can be thought of
as a processing pipeline. Some commands specify geometric objects to be drawn, and others
control how the objects are handled during the various processing stages.
Aim
The aim of developing Traffic Signal is to assign the right-of-way at intersecting streets or
highways where,without such control, a continual flow of vehicles on one road way would
cause excessive delay to vehicles and pedestrians waiting on the other roadway.
We cannot control the vehicles manually hence we need a device to control it and to avoid
accidents.
1.2 Motivation
Development of quantitative measures of oversaturated condition from traditional detection
systems.
Applications
Ramp meeting
Timers
Fire station or medical emergency entrance
At the entrance and exit of some car washes
At the landing stage of a ferry and aboard the ferry
1.5 Advantages
Provide for orderly movement of traffic;
Increase traffic-handling capacity of an intersection;
Reduce frequency and severity of certain types of crashes, especially right-angle
collisions;
Provide for continuous movement of traffic at a definite speed along a given route;
Interrupt heavy traffic at intervals to permit other vehicles or pedestrians to
cross
CHAPTER 2
LITERATURE SURVEY
A literature review is a written document that presents a logically argued case founded on
a comprehensive understanding of the current state of knowledge about a topic of study. This
literature review discusses about the work on traffic signal applications.
2.1 Related work
1. Traffic lights, traffic signals ,stoplights or robots are signalling devices positioned at
road intersections, pedestrian crossings, and other locations to control flows of
traffic.
2. The world’s first traffic light was a manually operated gas lit signal installed in
London in December 1868. It exploded less than a month after it was implemented,
injuring its policeman operator. Earnest Sirrine from Chicago patented the first
automated traffic control system in1910. It used the words “STOP and “PROCEED”,
although neither word was illuminated.
3. Traffic lights followed a universal color code which alternates the right of way
accorded to users with a sequence of illuminating lamps or LEDs of three standard
colours.
4. GREEN light: allows traffic to proceed in the direction denoted, if it is safe to do so
and there is room on the other side of the intersection.
RED light: prohibits any traffic from proceeding. A flashing red indication requires traffic
to stop and then proceed when safe.
YELLOW light: warns that the signal is about to change to red, with some jurisdiction
requiring drivers to stop if it is safe to do so and others allowing drivers to go through the
intersection if safe to do so.
CHAPTER 3
SYSTEM ANALYSIS
Analysis involves requirement determination and specification. It is basically establishing the
requirements for all system elements and then mapping these requirements to software forms. It
should address issues such as: -
Analysis encompasses requirements gathering at the system level with small amount of top-level
design. The data obtained from the requirement determination phase are documented in Software
Requirement Specification (SRS) document. During analysis, a great deal of relatively
unstructured data is collected through procedural manuals and through websites. The traditional
approach is to organize and convert the data through system flowcharts, which support future
developments of the system and simplify communication with users. But the system flowcharts
represent the physical system rather than the logical system. Hence, it makes it difficult to
distinguish between what happens and how it happens in the system. Because of this drawback it
is necessary to have something, which is analogous to the architect's blueprint as a starting point
for the design. It is the way of focus on the functions rather than physical implementation.
Unnecessary or excessive traffic signals can create hazards. One of the greatest obstacles to
applying sound principles of traffic engineering is the common belief that simply installing a traffic
signal will solve any traffic problem.
• GRAPHICS SYSTEM,
• Pentium P4 with 256 of Ram(Min)
OPENGL
3.3 Existing Systems
The existing system involves detection of vehicles which are breaking traffic
signal. It has central controller that is Arduino at junction which is connected to
sensors are placed at every road of junction which detects the vehicles which
might be inefficient when more than one peoples simultaneously go
Trough that way but single person is allow because of particular arrangement of
sensors. Consider if red signal is on and vehicle break signal then it will detect by
sensors and this signal is sent to Arduino. The Arduino capture image of that
vehicle using camera and save it as time and date format. The cameras are set at
every junction point is equal to the number of road meet at that junction.
Smart traffic signal device is made of three basic things that are ultrasonic sensor for detecting
the vehicle passing through when signal is on, microcontroller for examining the input coming
from ultrasonic sensor and give instruction to camera to capture image. In STS two sensors are
placed at one side of one road as shown in figure 4.1. That is if there are for road meet at one
traffic signal then four STS should be placed at every road. Generally width of road in India is 20
foot. The ultrasonic sensor covers the maximum area 4 meters (13.1234 foot) means sensors on
both sides are able to cover all area. The number of sensors on the both sides is increased
for more accuracy. If only one sensor detect the obstacle then proposed system STS is not
capture image because it may be human, animals etc. The length of vehicles is nearly about
equal to distance between two sensors on one side. This same system is applied on the opposite
side of road. Range of this two sensors are fixed as width of the road required to block with
respect to signal. This whole process is controlled by Arduino board which get input
from two or more ultrasonic sensors and capture image through camera and then save it as
name and date as the name of the image to make it easier to understand whenever the
vehicle paper size.
Fig:Block diagram of traffic signal
Economic Feasibility
Development of this application is highly economically feasible. The only thing to be done is
making an environment with an effective supervision. It is cost effective in the sense that has
eliminated the paper work completely. The system is also time effective because the calculations
are automated which are made at the end of the month or as per the user requirement.
Operational Feasibility
The system working is quite easy to use and learn due to its simple but attractive interface. User
requires no special training for operating the system.
Load Data: There are many cities which are uploaded to the database to generate a result
about traffic.
Non-functional requirements
Maintainability –The system provides a better platform for tracking and monitoring the
vehicles.
Reliability – The system is scalable as it provides the better and faster results.
The system is capable of processing when the large numbers of images are provided as
input and also it must be interactive and delays involved should be less. So, in every
action-response of the system, there should be no long-term delays.
CHAPTER 4
The Software design includes different design materials. The designs are Architectural, Work
flow, Use case, Activity, Sequence, Database, Form Design. These designs are used in software
development of a web-application and provides details of how the android - application should be
created.
4.1.1. Product Perspective
The design process involves developing several models of the system at different levels of
abstraction. As design is decomposed, errors and omissions in earlier stages are discovered. And
their feedbacks help in earlier design models to be improved. The various design activities are:
Architectural design: The sub-systems making up the systems and their relationships
are identified and documented.
Abstract Specification: For each sub-system an abstract specification of the services it
provides and the constraint under which it must be operate is produced.
Interface Design: For each sub-system, its interfaces with other sub-systems is designed
and documented. This interface specification must be unambiguous as it allows the sub-
system to be used without knowledge of the sub-system operation.
Component Design: Services are allocated to different components and the interfaces of
these components are designed.
Algorithm Design: The algorithms are used to provide services that are designed in
detail with corresponding specifications.
4.2.1Methodology
The study helps to clearly understand the concept, approach and certain terminology that revolve
around the project. The data from the GPS collar will be uploaded to the database and then the
database will send the last data uploaded to the Android application.
The development of both GPS tag and Android devices are done separately. This is because, both
tasks are connected only to the database. For GPS collar, the task that is required to accomplish is
to link the tag to the database.
As soon as GPS tag and the Android app are working, the system will be tested. This project is
divided into two implemented parts: software and hardware. The software part is programmed
and that works in (Java /other programming language) Environment and the large database
system is designed by (SQLite Database Server version.
Decision Tree Algorithm: A decision tree is a structure that includes a root node,
branches, and leaf nodes. Each internal node denotes a test on an attribute, each branch
denotes the outcome of a test, and each leaf node holds a class label. The topmost node in
the tree is the root node.
4.2.2Data Flow Diagram: The DFD is also called as bubble chart. It is a simple graphical
formalism that can be used to represent a system in terms of input data to the system, various
processing carried out on this data, and the output data is generated by this system.
D ec is io n Tre e
C o un t D a ta s e t
C re at e N od e Tree s
F et c h D a ta s et s
D a ta s et D e t ails
ge ne rat e G ra ph
The form design is about the web pages created in the system. In simple it is those hyperlink
pages that appear before user logs into the system. The web forms are Home, Load data, Disease
Prediction, Comparison Study. The other pages are Decision Tree.
4.3. System Modelling and Design
This section discusses the design methodology and basic theory of components of the
project with the section further divided into sections for components theory and system
design & analysis.
CHAPTER 5
IMPLEMENTATION
A software system test plan is a document that describes the objectives, scope, approach and
focus of software testing effort. The process of preparing a test plan is a usual way to think the
efforts needed to validate the acceptability of a software product. The complete document will
help people outside the test group understand the "WHY" and "HOW" product validation. It
should be through enough to be useful but not so through that no one outside the test group will
read it.
Various functions used in this program.
glutInit() : interaction between the windowing system and OPENGL is
initiated
// #include "stdafx.h"
#include "GL/freeglut.h"
#include "GL/gl.h"
// #include<GL/glut.h>
// #include <stdio.h>
#include <string>
#include <iostream>
#define ESCAPE 27
#define HIGH 1
#define RED 0
#define YELLOW 1
#define GREEN 2
int view=0;
bool rl1[] = {false, false, true};
int i=0;
glColor3f(0.0,0.0,0.8);
glRasterPos2f(x,y);
for(i=0;i<s.length();i++) {
if(font==1)
glutBitmapCharacter(GLUT_BITMAP_TIMES_ROMAN_24,s[i]);
else if(font==2)
glutBitmapCharacter(GLUT_BITMAP_HELVETICA_18,s[i]);
else if(font==3) {
glColor3f(1.0,0.0,0.0);
glutBitmapCharacter(GLUT_BITMAP_HELVETICA_18,s[i]);
void First_win() {
glClearColor(1.0,1.0,0.6,1.0);
text(390,660,"Using OpenGL",1);
text(430,620,"Made By:",2);
text(400,540,"INSTRUCTIONS::",2);
glutPostRedisplay();
//glutSwapBuffers();
void init() {
glClearColor(0, 0, 0, 0);
glPointSize(5.0);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(0.0,1000,0.0,800,50.0,-50.0);
glutPostRedisplay();
void car_chalao() {
crx += 3;
crx -= 3;
crx += 3;
crx = -300;
void bus_chalao() {
// blx -= 2;
blx -=2;
blx += 2;
blx -= 2;
blx = -300;
void bus() {
glPushMatrix();
glTranslated(blx,-100,0);
glScaled(50.0,50.0,0.0);
glColor3f(0.5,0.0,0.0);
glBegin(GL_POLYGON);
glVertex2f(25,8);
glVertex2f(25,9.5);
glVertex2f(26,11);
glVertex2f(32,11);
glVertex2f(32,8);
glEnd();
//window frame
glColor3f(0,0.1,1);
glBegin(GL_POLYGON);
glVertex2f(26.1,9.5);
glVertex2f(26.1,10.5);
glVertex2f(31.8,10.5);
glVertex2f(31.8,9.5);
glEnd();
//Doors
glColor3f(0,0.8,1);
glBegin(GL_POLYGON);
glVertex2f(26.2,9);
glVertex2f(26.2,10.4);
glVertex2f(27.7,10.4);
glVertex2f(27.7,9);
glEnd();
glColor3f(1,1,1);
glBegin(GL_POLYGON);
glVertex2f(27,8.4);
glVertex2f(27,10.4);
glVertex2f(27.7,10.4);
glVertex2f(27.7,8.4);
glEnd();
//small windows
glColor3f(0,1,1);
glBegin(GL_POLYGON);
glVertex2f(27.8,9.6);
glVertex2f(27.8,10.4);
glVertex2f(29,10.4);
glVertex2f(29,9.6);
glEnd();
glBegin(GL_POLYGON);
glVertex2f(29.1,9.6);
glVertex2f(29.1,10.4);
glVertex2f(30.2,10.4);
glVertex2f(30.2,9.6);
glEnd();
glBegin(GL_POLYGON);
glVertex2f(30.3,9.6);
glVertex2f(30.3,10.4);
glVertex2f(31.7,10.4);
glVertex2f(31.7,9.6);
glEnd();
//driver window
glColor3f(0,0.8,1);
glBegin(GL_POLYGON);
glVertex2f(25,9.5);
glVertex2f(26,11);
glVertex2f(26,9.5);
glEnd();
glPopMatrix();
//tyre
glPushMatrix();//front tyre
glTranslated(blx+1220,250,0.0);
glScaled(20.0,20.0,0.0);
glColor3f(0.0,0.0,0.0);
glBegin(GL_POLYGON);
glVertex2f(3.0,2.5);
glVertex2f(3.0,2.6);
glVertex2f(3.15,3.1);
glVertex2f(3.2,3.2);
glVertex2f(3.3,3.35);
glVertex2f(3.4,3.4);
glVertex2f(3.5,3.45);
glVertex2f(3.6,3.55);
glVertex2f(3.7,3.6);
glVertex2f(3.8,3.63);
glVertex2f(4.0,3.65);
glVertex2f(4.2,3.7);
glVertex2f(4.4,3.7);
glVertex2f(4.6,3.65);
glVertex2f(4.8,3.55);
glVertex2f(5.0,3.45);
glVertex2f(5.1,3.4);
glVertex2f(5.2,3.25);
glVertex2f(5.3,3.2);
glVertex2f(5.4,3.0);
glVertex2f(5.5,2.5);
glVertex2f(5.45,2.15);
glVertex2f(5.4,1.9);
glVertex2f(5.35,1.8);
glVertex2f(5.2,1.6);
glVertex2f(5.0,1.5);
glVertex2f(4.9,1.4);
glVertex2f(4.7,1.3);
glVertex2f(4.6,1.27);
glVertex2f(4.4,1.25);
glVertex2f(4.0,1.25);
glVertex2f(3.9,1.3);
glVertex2f(3.75,1.35);
glVertex2f(3.6,1.4);
glVertex2f(3.45,1.55);
glVertex2f(3.3,1.7);
glVertex2f(3.2,1.8);
glVertex2f(3.1,2.2);
glEnd();
glPopMatrix();
glPushMatrix();//back tyre
glTranslated(blx+1460,250,0.0);
glScaled(20.0,20.0,0.0);
glColor3f(0.0,0.0,0.0);
glBegin(GL_POLYGON);
glVertex2f(3.0,2.5);
glVertex2f(3.0,2.6);
glVertex2f(3.15,3.1);
glVertex2f(3.2,3.2);
glVertex2f(3.3,3.35);
glVertex2f(3.4,3.4);
glVertex2f(3.5,3.45);
glVertex2f(3.6,3.55);
glVertex2f(3.7,3.6);
glVertex2f(3.8,3.63);
glVertex2f(4.0,3.65);
glVertex2f(4.2,3.7);
glVertex2f(4.4,3.7);
glVertex2f(4.6,3.65);
glVertex2f(4.8,3.55);
glVertex2f(5.0,3.45);
glVertex2f(5.1,3.4);
glVertex2f(5.2,3.25);
glVertex2f(5.3,3.2);
glVertex2f(5.4,3.0);
glVertex2f(5.5,2.5);
glVertex2f(5.45,2.15);
glVertex2f(5.4,1.9);
glVertex2f(5.35,1.8);
glVertex2f(5.2,1.6);
glVertex2f(5.0,1.5);
glVertex2f(4.9,1.4);
glVertex2f(4.7,1.3);
glVertex2f(4.6,1.27);
glVertex2f(4.4,1.25);
glVertex2f(4.0,1.25);
glVertex2f(3.9,1.3);
glVertex2f(3.75,1.35);
glVertex2f(3.6,1.4);
glVertex2f(3.45,1.55);
glVertex2f(3.3,1.7);
glVertex2f(3.2,1.8);
glVertex2f(3.1,2.2);
glEnd();
glPopMatrix();
void car() {
glLineWidth(1.0);
glTranslated(crx,400.0,0.0);
glScaled(20.0,20.0,0.0);
glColor3f(0.2,0.3,1.0);
glBegin(GL_POLYGON);
glVertex2f(2.5,2.5);
glVertex2f(3.0,3.5);
glVertex2f(3.5,3.75);
glVertex2f(4.0,4.0);
glVertex2f(4.5,4.0);
glVertex2f(5.0,3.75);
glVertex2f(5.5,3.5);
glVertex2f(5.75,3.0);
glVertex2f(6.0,2.5);
glVertex2f(16.5,2.5);
glVertex2f(16.75,3.0);
glVertex2f(17.0,3.5);
glVertex2f(17.5,3.75);
glVertex2f(18.0,4.0);
glVertex2f(18.5,4.0);
glVertex2f(19.0,3.75);
glVertex2f(19.5,3.5);
glVertex2f(19.75,3.0);
glVertex2f(20.0,2.5);
glVertex2f(21.0,2.5);
glVertex2f(21.0,4.0);
glVertex2f(21.5,4.0);
glVertex2f(21.0,4.5);
glVertex2f(20.0,5.0);
glVertex2f(15.0,5.0);
glVertex2f(14.0,5.5);
glVertex2f(13.0,6.0);
glVertex2f(12.0,6.5);
glVertex2f(11.0,7.0);
glVertex2f(6.0,7.0);
glVertex2f(5.0,6.5);
glVertex2f(4.5,6.25);
glVertex2f(4.25,6.0);
glVertex2f(4.0,5.75);
glVertex2f(3.5,5.5);
glVertex2f(3.0,5.5);
glVertex2f(1.9,5.45);
glVertex2f(1.8,5.4);
glVertex2f(1.7,5.35);
glVertex2f(1.6,5.3);
glVertex2f(1.5,5.25);
glVertex2f(1.4,5.15);
glVertex2f(1.3,5.0);
glVertex2f(1.2,4.85);
glVertex2f(1.1,4.7);
glVertex2f(1.0,4.3);
glVertex2f(1.0,3.2);
glVertex2f(1.1,3.05);
glVertex2f(1.2,2.9);
glVertex2f(1.3,2.9);
glVertex2f(1.4,2.75);
glVertex2f(1.5,2.65);
glVertex2f(1.6,2.6);
glVertex2f(1.7,2.55);
glVertex2f(1.8,2.5);
glVertex2f(1.9,2.45);
glVertex2f(2.0,2.5);
glEnd();
glBegin(GL_POLYGON);
glVertex2f(5.0,5.0);
glVertex2f(14.0,5.0);
glVertex2f(11.5,6.5);
glVertex2f(10.5,6.75);
glVertex2f(7.0,6.75);
glEnd();
glColor3f(0.0,0.0,0.0);
glVertex2f(3.0,2.5);
glVertex2f(3.0,2.6);
glVertex2f(3.15,3.1);
glVertex2f(3.2,3.2);
glVertex2f(3.3,3.35);
glVertex2f(3.4,3.4);
glVertex2f(3.5,3.45);
glVertex2f(3.6,3.55);
glVertex2f(3.7,3.6);
glVertex2f(3.8,3.63);
glVertex2f(4.0,3.65);
glVertex2f(4.2,3.7);
glVertex2f(4.4,3.7);
glVertex2f(4.6,3.65);
glVertex2f(4.8,3.55);
glVertex2f(5.0,3.45);
glVertex2f(5.1,3.4);
glVertex2f(5.2,3.25);
glVertex2f(5.3,3.2);
glVertex2f(5.4,3.0);
glVertex2f(5.5,2.5);
glVertex2f(5.45,2.15);
glVertex2f(5.4,1.9);
glVertex2f(5.35,1.8);
glVertex2f(5.2,1.6);
glVertex2f(5.0,1.5);
glVertex2f(4.9,1.4);
glVertex2f(4.7,1.3);
glVertex2f(4.6,1.27);
glVertex2f(4.4,1.25);
glVertex2f(4.0,1.25);
glVertex2f(3.9,1.3);
glVertex2f(3.75,1.35);
glVertex2f(3.6,1.4);
glVertex2f(3.45,1.55);
glVertex2f(3.3,1.7);
glVertex2f(3.2,1.8);
glVertex2f(3.1,2.2);
glEnd();
glVertex2f(17.0,2.5);
glVertex2f(17.0,2.6);
glVertex2f(17.15,3.1);
glVertex2f(17.2,3.2);
glVertex2f(17.3,3.35);
glVertex2f(17.4,3.4);
glVertex2f(17.5,3.45);
glVertex2f(17.6,3.55);
glVertex2f(17.7,3.6);
glVertex2f(17.8,3.63);
glVertex2f(18.0,3.65);
glVertex2f(18.2,3.7);
glVertex2f(18.4,3.7);
glVertex2f(18.6,3.65);
glVertex2f(18.8,3.55);
glVertex2f(19.0,3.45);
glVertex2f(19.1,3.4);
glVertex2f(19.2,3.25);
glVertex2f(19.3,3.2);
glVertex2f(19.4,3.0);
glVertex2f(19.5,2.5);
glVertex2f(19.45,2.15);
glVertex2f(19.4,1.9);
glVertex2f(19.35,1.8);
glVertex2f(19.2,1.6);
glVertex2f(19.0,1.5);
glVertex2f(18.9,1.4);
glVertex2f(18.7,1.3);
glVertex2f(18.6,1.27);
glVertex2f(18.4,1.25);
glVertex2f(18.0,1.25);
glVertex2f(17.9,1.3);
glVertex2f(17.75,1.35);
glVertex2f(17.6,1.4);
glVertex2f(17.45,1.55);
glVertex2f(17.3,1.7);
glVertex2f(17.2,1.8);
glVertex2f(17.1,2.2);
glEnd();
glPopMatrix();
void traffic_light() {
glPushMatrix();
glTranslatef(-190,20,0);
glColor3f(0.0,0.0,0.0);
glBegin(GL_POLYGON);
// glColor3f(0.7,0.3,0.0);
glVertex2d(600,350); //1
glVertex2d(650,350); //2
glVertex2d(650,370); //3
glVertex2d(600,370); //12
glEnd();
glPopMatrix();
glPushMatrix();
glTranslatef(-190,20,0);
glBegin(GL_POLYGON);
// glColor3f(0.6,0.2,0.0);
glVertex2d(630,370); //4
glVertex2d(630,520); //5
glVertex2d(620,520); //10
glVertex2d(620,370); //11
glEnd();
glPopMatrix();
glPushMatrix();
glTranslatef(-190,20,0);
glBegin(GL_POLYGON);
// glColor3f(0.7,0.3,0.0);
glVertex2d(600,450); //6
glVertex2d(600,600); //7
glVertex2d(550,600); //8
glVertex2d(550,450); //9
glEnd();
glPopMatrix();
glPushMatrix();
glTranslatef(-190,20,0);
glBegin(GL_POLYGON);
// glColor3f(0.7,0.3,0.0);
glVertex2d(700,450); //11
glVertex2d(700,600); //12
glVertex2d(650,600); //13
glVertex2d(650,450); //14
glEnd();
glPopMatrix();
//Connecting Rod
glPushMatrix();
glTranslatef(-190,20,0);
glBegin(GL_POLYGON);
// glColor3f(0.7,0.3,0.0);
glVertex2d(650,520); //15
glVertex2d(650,540); //16
glVertex2d(600,540); //17
glVertex2d(600,520); //18
glEnd();
glPopMatrix();
//Left Lights
//Red 1
glPushMatrix();
if(rl1[RED])
else
glPopMatrix();
//Yellow 1
glPushMatrix();
if(rl1[YELLOW])
else
glPopMatrix();
//Green 1
glPushMatrix();
if(rl1[GREEN])
else
//Right Lights
//Red 2
glPushMatrix();
if(rl2[RED])
else
glPopMatrix();
//Yellow 2
glPushMatrix();
if(rl2[YELLOW])
else
glPopMatrix();
//Green 2
glPushMatrix();
if(rl2[GREEN])
glPopMatrix();
glPushMatrix();
glColor3f(r,g,b);
glLineWidth(2.0);
glBegin(GL_LINES);
glVertex2d(x,y);
glVertex2d(p,q);
glEnd();
glPopMatrix();
void grass()
float r=1.0,g=0.0,b=0.8;
if(r>0)
r-=.2;
else
r=1.0;
if(g<1)
g+=.2;
else
g=0.0;
if(b>0)
b-=.2;
else
b=1.0;
gra(i+k,525,30+k,500,r,g,b);
if(r>0)
r-=.2;
else
r=1.0;
if(g<1)
g+=.2;
else
g=0.0;
if(b>0)
b-=.2;
else
b=1.0;
for(int i=500,c=0;c<5;i+=15,c++)
gra(i+k,525,530+k,500,r,g,b);
}
}
void white_strips() {
//Left
glPushMatrix();
glEnable(GL_LINE_STIPPLE);
glLineWidth(12.0);
glDisable(GL_LINE_STIPPLE);
glPopMatrix();
//Right
glPushMatrix();
glEnable(GL_LINE_STIPPLE);
glLineWidth(12.0);
glDisable(GL_LINE_STIPPLE);
glPopMatrix();
void zebra() {
//Left
glPushMatrix();
glLineWidth(12.0);
glDisable(GL_LINE_STIPPLE);
glPopMatrix();
//Right
glPushMatrix();
glEnable(GL_LINE_STIPPLE);
glLineWidth(12.0);
glDisable(GL_LINE_STIPPLE);
glPopMatrix();
//Top
glPushMatrix();
glEnable(GL_LINE_STIPPLE);
glLineWidth(12.0);
glDisable(GL_LINE_STIPPLE);
glPopMatrix();
void road_strips() {
glPushMatrix();
glBegin(GL_POLYGON);
glColor3f(0.85,0.64,0.12);
glVertex2d(0,200);
glVertex2d(0,250);
glVertex2d(1000,250);
glVertex2d(1000,200);
glEnd();
glPopMatrix();
glPushMatrix();
glBegin(GL_POLYGON);
glColor3f(0.5,0.5,0.5);
glVertex2d(0,250);
glVertex2d(0,500);
glVertex2d(1000,500);
glVertex2d(1000,250);
glEnd();
glPopMatrix();
glPushMatrix();
glBegin(GL_POLYGON);
glColor3f(0.5,0.5,0.5);
glVertex2d(300,500);
glVertex2d(200,800);
glVertex2d(350,800);
glVertex2d(500,500);
glEnd();
glPopMatrix();
zebra();
//Grass
grass();
//Dotted strips
white_strips();
car();
traffic_light();
bus();
car_chalao();
bus_chalao();
}
void main_display() {
glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
if(view==0) {
init();
First_win();
else {
//---------CONSTANT PARTS
//ROAD STRIP
road_strips();
glutSwapBuffers();
void traffic_start() {
switch(key) {
case ESCAPE:exit(1);
//glColor3f(0.85,0.64,0.12);
traffic_start();
break;
case 'q':
rl1[RED] = true;
rl1[YELLOW] = false;
rl1[GREEN] = false;
break;
case 'w':
rl1[RED] = false;
rl1[YELLOW] = true;
rl1[GREEN] = false;
break;
case 'e':
rl1[RED] = false;
rl1[YELLOW] = false;
rl1[GREEN] = true;
break;
case 'a':
cout<<"Red light 2 to RED"<<endl;
rl2[RED] = true;
rl2[YELLOW] = false;
rl2[GREEN] = false;
break;
case 's':
rl2[RED] = false;
rl2[YELLOW] = true;
rl2[GREEN] = false;
break;
case 'd':
rl2[RED] = false;
rl2[YELLOW] = false;
rl2[GREEN] = true;
break;
default:
glViewport(0,0,w,h);
cout<<"Width="<<w<<" height= "<<h<<endl;
glutInit(&argc,argv);
glutInitDisplayMode(GLUT_RGBA|GLUT_DEPTH|GLUT_DOUBLE);
glutInitWindowSize(1000,800);
glutInitWindowPosition(0,0);
//glutFullScreen();
glutDisplayFunc(main_display);
glutReshapeFunc(reshape);
glutKeyboardFunc(keyboard);
glutIdleFunc(main_display);
//glutMouseFunc();
glutMainLoop();
return 0;
}
CHAPTER 6
SYSTEM TESTING
Software testing is a process of executing a program or application with the intent of finding the
software bugs. It can also be stated as the process of validating and verifying that a software
program or application or product meets the business and technical requirements that guided its
design and development. The purpose of testing can be quality assurance, verification and
validation, or reliability estimation. Testing can be used as a generic metric as well. Correctness
testing and reliability testing are two major areas of testing. Software testing is a trade-off
between budget, time and quality.
6.1. What is Verification and Validation?
Verification is the process to make sure the product satisfies the conditions imposed at the start of
the development phase. In other words, to make sure the product behaves the way we want it to.
Validation is the process to make sure the product satisfies the specified requirements at the end
of the development phase. In other words, to make sure the product is built as per customer
requirements.
6.2. Key Benefits of Testing
The key benefits of testing are
Reduced risk of failures (or incidents) once systems are transferred to live operation
Demonstrative proof that business requirements have been met
Assurance that the system will function appropriately with existing legacy systems
where required and will integrate with other systems as necessary
Assurance that the users for which the solution was designed are able to operate
productively
Acknowledging these benefits requires accepting the reality that testing costs money. Too much
testing could be risky, as it may delay product launch and allow a competitor to steal significant
market share. Unfocused, inefficient approaches to test management often result in poor return
on investment in testing. As a rule of thumb, sufficient testing is where the costs of testing can be
balanced against the potential costs of failures and over run. The risks of failure and business
benefit should be used to determine how much testing is performed.
6.3. Basics of Testing
There are two basics of software testing: Blackbox testing and Whitebox testing.
6.3.1. Behavioural testing:
Behavioural or Black-box testing is a method of software testing that examines the functionality
of an application without peering into its internal structures or workings. This method of test can
be applied to virtually every level of software testing: unit, integration, system and acceptance.
6.3.2. Structural Testing
Structural or White box testing is a testing technique that examines the program structure and
derives test data from the program logic/code. The other names of glass box testing are clear box
testing, open box testing, logic driven testing or path driven testing or structural testing.
6.4. Types of Testing
Testing is the process where we validate and verify if the product meets the user’s requirements
and adheres to the specification. There are several types of testing processes available.
• Unit Testing
• Integration Testing
• Functional Testing
• System Testing
• Stress Testing
• Performance Testing
• Usability Testing
• Acceptance Testing
• Regression Testing
• Beta Testing
The project “Traffic Signal” clearly demonstrates the simulation of traffic signal
using OpenGL.
Finally we conclude that this program clearly illustrate the traffic signal using
openGL and has been completed successfully and is ready to be demonstrated.
FUTURE ENHANCEMENT
REFERENCES
http://jerome.jouvie.free.fr/OpenGl/Lessons/Lesson3.php
http://google.com
http://opengl.org