Traffic Signal
Traffic Signal
“Traffic Signal”
Submitted by
RISHIKESH ZALAKE VISHAL BASHETTI
USN: 2KL16CS069 USN: 2KL16CS116
Department of CSE
USN No. 2KL16CS069 , 2KL16CS116 has satisfactorily completed the mini project
entitled “Traffic Signal” for partial fulfilment of Computer Graphics and Visualization Lab of
VI Semester Bachelor of Engineering in Computer Science and Engineering of the Visvesvaraya
Technological University, Belagavi for the year 2018-2019.
Examiner 1 Examiner 2
Name: Name:
Signature: Signature:
ACKNOWLEDGEMENT
1.INTRODUCTION
Computer Graphics :
Graphics provides 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. Interactive computer graphics is the most important means
of producing pictures since the invention of photography and television. It has the added
advantage that, with the computer, we can make pictures not only of concrete real world objects
but also of abstract, synthetic objects, such as mathematical surfaces and of data that have no
inherent geometry, such as survey results.
OpenGL :
OpenGL (Open Graphics Library) is a standard specification defining a cross language cross
platform API for writing applications that produce 2D and 3D computer graphics. The interface
consists of over 250 different function calls which can be used to draw complex 3D scenes from
simple primitives. OpenGL was developed by Silicon Graphics Inc. (SGI) in 1992 and is widely
used in CAD, virtual reality, scientific visualization, information visualization and flight
simulation. It is also used in video games, where it competes with direct 3D on Microsoft
Windows Platforms. OpenGL is managed by the non profit technology consortium, the Khronos
group.INC.
Z buffering .
Texture Mapping.
Alpha Blending.
Pixel Operation: While geometric data takes one path through the OpenGL rendering
pipeline, pixel data takes a different route. Pixels from an array in system memory are first
unpacked from one of a variety of formats into the proper number of components. Next the data
is scaled, biased, and processed by a pixel map. The results are clamped and then either written
into texture memory or sent to the rasterization step.
Rasterization: Rasterization is the conversion of both geometric and pixel data into
fragments. Each fragment square corresponds to a pixel in the framebuffer. Color and depth
values are assigned for each fragment square.
Fragment Operations : Before values are actually stored into the framebuffer, a series of
operations are performed that may alter or even throw out fragments. All these operations can be
enabled or disabled.
Display Lists : All data, whether it describes geometry or pixels, can be saved in a display list
for current or later use. When a display list is executed, the retained data is sent from the display
list just as if it were sent by the application in immediate mode.
Evaluators: All geometric primitives are eventually described by vertices. Parametric curves
and surfaces may be initially described by control points and polynomial functions called basis
functions.
2. SYSTEM REQUIREMENTS
HARDWARE REQUIREMENTS:
128 MB of RAM, 256 MB recommended.
110 MB of hard disk space required, 40 MB additional hard disk space required for
installation (150 MB total).
SOFTWARE REQUIREMENTS:
This traffic signal simulator has been designed for WINDOWS10. OpenGL libraries are used
and hence VISUAL STUDIO 2010 is required.
Development Platform: Windows 10
Language : C ++
Tool : Visual Studio 2010
Library : OpenGL
3. IMPLEMENTATION
The implementation of the different objects in this project is divided into different module.
MODULE 1:
OUTER LINE CODE FOR DESIGN A CAR:
Color3f(0.0,0.0,0.0);
glBegin(GL_LINE_LOOP);
glVertex2f(….);
glEnd();
MODULE 2:
ROAD:
void road()
{
glPushMatrix();
glScaled(40.0,40.0,0.0);
glColor3f(0.1,0.1,0.1);
glBegin(GL_POLYGON);
//straight road
glVertex2f(0,5);
glVertex2f(40,5);
glVertex2f(40,10);
glVertex2f(0,10);
glEnd();
}
MODULE 3:
SIGNAL POLE:
void signal()
{
glPushMatrix();
glScaled(40.0,40.0,0.0);
//stand
glColor3f(0.1,0.2,0.1);
glBegin(GL_POLYGON);
glVertex2f(…);
glEnd();
//pole
glBegin(GL_POLYGON);
glVertex2f(…);
glEnd();
//board
glBegin(GL_POLYGON);
glVertex2f(…);
glEnd();
//red
glColor3f(p,0.0,0.0);
glBegin(GL_POLYGON);
glVertex2f(…);
glEnd();
//yellow
glColor3f(q,q,0.0);
glBegin(GL_POLYGON);
glVertex2f(…);
glEnd();
//green
glColor3f(0.0,r,0.0);
glBegin(GL_POLYGON);
glVertex2f(…);
glEnd();
glPopMatrix();
}
4.SNAPSHOTS
The code we have implemented for our project is working well to the best of our knowledge.
In this project the traffic signal and vehicles act as per the users’s command.This project is both
informative and entertaining . This project provided an opportunity to learn the various concepts
of the subject in detail and provided us a platform to express our creativity and imagination come
true.