VISVESVARAYA TECHNOLOGICAL UNIVERSITY
Jnana Sangama, Belagavi – 590 018
A MINI PROJECT REPORT
on
“FESTIVAL OF INDIA”
Submitted in partial fulfillment of the requirement for the curriculum of the 6th semester
Bachelor of Engineering
In
Computer Science & Engineering
by
Abhishek M (1VI19CS128)
Rohan Jain (1VI20CS405)
Under the supervision of
Mr. Noor Basha Mr. Naveen H S
Assistant Professor Assistant Professor
DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING
VEMANA INSTITUTE OF TECHNOLOGY
Bengaluru-560034
2021-2022
Karnataka Reddyjana Sangha®
VEMANA INSTITUTE OF TECHNOLOGY
Koramangala, Bengaluru-34.
(Affiliated to Visvesvaraya Technological University, Belagavi)
Department of Computer Science & Engineering
Certificate
This is certified that the Computer Graphics mini project work entitled “TRANSFORMER”
carried out by Abhishek M (1V19CS128) and Rohan Jain (IVI20CS405) are bonafide
students of Vemana Institute of Technology in partial fulfillment of the award of Bachelor
of Engineering in Computer Science and Engineering of the Visvesvaraya Technological
University, Belagavi during the academic year 2021-2022. It is certified that all
corrections/suggestions indicated for internal assessment have been incorporated in the report.
The project report has been approved as it satisfies the academic requirements in respect of the
project work prescribed for the said degree.
_________________ _________________ _________________
Guide-I Guide-II HOD
Mr. Noor Basha Mr. Naveen H S Dr. M Ramakrishna
External Viva
Name of the Examiners Signature with date
1.____________________ 1. ____________________
2.____________________ 2. ____________________
ACKNOWLEDGEMENT
We sincerely thank Visvesvaraya Technological University for providing a platform to do
the mini project.
Firstly, we would like to express our deep sense of gratitude to our institute “VEMANA
INSTITUTE OF TECHNOLOGY” that provided us an opportunity to do a project entitled
“FESTIVAL OF INDIA”.
We thank Dr. Vijayasimha Reddy. B.G, Principal, Vemana Institute of Technology,
Bengaluru for providing the necessary support.
We would like to place on record our regards to Dr. M. Ramakrishna, Head of the
Department Computer Science and Engineering for his continued support.
We would like to thank our project guide Mr. Naveen H S, Assistant Professor, Dept. of
CSE and Mr. Noor Basha, Assistant Professor, Dept. of CSE for their continuous support
and valuable guidance towards successful completion of the project.
We would be failing in our duty if we do not thank the faculty members, lab staffs,
technicians and family members for their constant support and guidance.
Date: Abhishek M (1VI20CS402)
Place: BANGALORE Rohan Jain (1VI18CS049)
ABSTRACT
“Festivals of India” is a 2D graphics based educating project. The project has scope to learn
Computer Graphics from fundamentals. Festivals are an expressive way to celebrate glorious
heritage, culture and traditions. They are meant to rejoice special moments and emotions in our
lives with our loved ones. They play an important role to add structure to our social lives, and
connect us with our families and backgrounds.
i
CONTENTS
No. Title Page No.
Abstract i
List of Figures iii
1 Introduction 1
1.1 Computer Graphics 2
1.2 OpenGL Technology 2
1.3 Project description: 3
2 Software Requirements Specification 5
2.1 Minimum Hardware Requirements 5
2.2 Minimum Software Specification 5
3 Design 6
3.1 System Design 6
3.2 Initialization 7
3.3 Event Processing 7
4 Implementation 8
5 Snapshots 12
Conclusion and Future Enhancement 14
References 15
ii
LIST OF FIGURES
Fig No. Title Page No.
Fig 1.1 A Graphics System 2
Fig 1.2 Graphics pipeline. 3
Fig 3.1 The Flow Diagram of the Festivals of India 6
Fig 5.1 Introduction page 12
Fig 5.2 Ramzan 12
Fig 5.3 Diwali 13
Fig 5.4 Christmas 13
iii
FESTIVALS OF INDIA INTRODUCTION
CHAPTER 1
INTRODUCTION
Computer graphics is conscerned with all aspects of producing picture or an image using
computers and, more generally, the representation and manipulation of pictorial data by a
computer. The development of computer graphics has made computers easier to interact with
and better for understanding and interpreting many types of data. Developments in computer
graphic had a profound impact on many types of media and have revolutionized the animation
and video game industry. Today computers and computer-generated images touch many
aspects of our daily life. Computer imagery is found on television, in newspapers, in weather
reports, and during surgical procedures. A well-constructed graph can present complex
statistics in a form that is easier to understand and interpret. Such graphs are used to illustrate
papers, reports, theses, and other presentation material. A range of tools and facilities are
available to enable users to visualize their data, and computer graphics are used in many
disciplines. We implement computer graphics using the OpenGL API. 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.
OpenGL is a low-level graphics library specification. It makes available to the
programmer a small set of geometric primitives - points, lines, polygons, images, and bitmaps.
OpenGL provides a set of commands that allow the specification of geometric objects in two
or three dimensions, using the provided primitives, together with commands that control how
these objects are rendered (drawn). Since OpenGL drawing commands are limited to those that
generate simple geometric primitives (points, lines, and polygons), the OpenGL Utility Toolkit
(GLUT) has been created to aid in the development of more complicated three-dimensional
objects such as a sphere, a torus, and even a teapot. GLUT may not be satisfactory for full-
featured OpenGL applications, but it is a useful starting point for learning OpenGL.
GLUT is designed to fill the need for a window system independent programming
interface for OpenGL programs. The interface is designed to be simple yet still meet the needs
of useful OpenGL programs. Removing window system operations from OpenGL is a sound
decision because it allows the OpenGL graphics system to be retargeted to various
Systems including powerful but expensive graphics workstations as well as mass-production
graphics systems like video games, set-top boxes for interactive television, and PCs.
Dept of CSE,Vemana IT 1 2021-2022
FESTIVALS OF INDIA INTRODUCTION
The GLUT application-programming interface (API) requires very few routines to display a
graphics scene rendered using OpenGL. The GLUT routines also take relatively few
parameters.
1.1 Computer Graphics
The term computer graphics includes almost everything on computers that is not text or sound.
Today nearly all computers use some graphics and users expect to control their computer
through icons and pictures rather than just by typing. The term Computer Graphics has several
meanings:
The representation and manipulation of pictorial data by a computer.
The various technologies used to create and manipulate such pictorial data.
The images so produced, and
The sub-field of computer science which studies methods for digitally synthesizing and
manipulating visual content.
Today computers and computer-generated images touch many aspects of our daily life.
Computer imagery is found on television, in newspapers, in weather reports, and during
surgical procedures. A well-constructed graph can present complex statistics in a form that is
easier to understand and interpretation fig 1.1 inputs go to processor from there to frame buffer
and then it displays the pixel.
Fig 1.1 A Graphics System
1.2 OpenGL Technology
OpenGL is strictly defined as “a software interface to graphics hardware.” In essence, it is a
3D graphics and modelling library that is highly portable and very fast. Using OpenGL, you
can create elegant and beautiful 3D graphics with exceptional visual quality. The greatest
advantage to using OpenGL is that it is orders of magnitude faster than a ray tracer or software-
Dept of CSE,Vemana IT 2 2021-2022
FESTIVALS OF INDIA INTRODUCTION
rendering engine. Initially, it used algorithms carefully developed and optimized by Silicon
Graphics, Inc. (SGI), an acknowledged world leader in computer graphics and animation.
Fig 1.2 shows it has four major steps in pipeline architecture:
1. Vertex processing: Much of the work in the pipeline is in converting object representations
from one co-ordinate system to another. Every vertex is processed independently.
The co-ordinate system includes the following:
Object co-ordinates
Camera co-ordinates
Screen co-ordinates.
2. Clipping and Primitive assembly: clipping is necessary, because of the limitation that no
imagining system can see the whole object at once. Cameras have film of limited size. Image
outside the clipping volume is clipped out. Clipping is done by vertex basis.
3. Rasterization: generation of pixels in the frame buffer. Rasterizer determines which pixels
in the frame buffer are inside the polygon. The output of the Rasterizer is a set of fragments
for each primitive. Fragments carry colour, location, depth and other information.
4. Fragment processing: Updates the pixel in the frame buffer. Color of the pixels that
correspond to fragment can be read from the frame buffer. Color fragment may be altered by
texture mapping.
Fig 1.2 Graphics pipeline.
The interface consists in more than 250 different functions, which can be used to raw complex
tridimensional scenes with simple primitives. It consists of many functions that help to create
a real-world object and a particular existence for an object can be given.
1.3 Project description:
In this project, we strive to obtain a slide of festivals of India. Basically, we promote to show
the different festivals of India we celebrate. This project describes the festival Ramzan, Diwali
and Christmas.
Ramadan is the name of the one of the twelve months of the Muslim calendar year.
Diwali is celebrated by Hindus Jains Buddhists to mark different historical events.
Christmas is celebrated to remember the birth of the Jesus Christ; who Christians
believe is the son of god
Dept of CSE,Vemana IT 3 2021-2022
FESTIVALS OF INDIA INTRODUCTION
We make use of C with OpenGL for entire coding purpose along with some features of
Windows. The OpenGL Utility is a Programming Interface. We use light and material
functions to add luster, shade and shininess to graphical objects. The toolkit supports much
functionalities like multiple window rendering, callback event driven processing using
sophisticated input devices etc.
Dept of CSE,Vemana IT 4 2021-2022
FESTIVALS OF INDIA REQUIREMENTS
CHAPTER 2
SYSTEM REQUIREMENTS SPECIFICATION
2.1 Minimum hardware requirements
Microprocessor: 1.0 GHz and above CPU based on either AMD or INTEL
Microprocessor Architecture.
Main memory: 512 MB RAM.
Hard Disk: 40 GB.
Hard disk speed in RPM: 5400 RPM.
2.2 Minimum software requirements
The graphics package has been designed for OpenGL; hence the machine must have
Dev C++.
Software installed preferably 6.0 or later versions with mouse driver installed. GLUT
libraries, Glut utility toolkit must be available.
Operating System: Windows
Version of Operating System: Windows XP, Windows NT and Higher
The package is implemented using Microsoft visual C++, under the windows platform.
OpenGL and associated toolkits are used for the package development.
OpenGL, a software interface for graphics hardware with built in graphics libraries like
glut and glut32, and header files like glut.h.
Dept of CSE,Vemana IT 5 2021-2022
TRANSFORMERS DESIGN
CHAPTER 3
DESIGN
3.1 System design:
Data Flow Diagram:
Start
Festivals of India
Introduction
Press 1 Press 2 Press 3 Press Q for
exiting the
terminal
Ramzan Diwali Christmas
Fig 3.1 The Flow Diagram of the Festivals of India
OpenGL is a software tool for developing the graphics objects. OpenGL library called GLUT
i.e. Graphics Library Utility toolkit supports graphics system with the necessary modelling and
rendering techniques. The Lighting system is a technique for displaying graphic objects on the
monitor and displaying the light effects. It provides the following functionalities.
Dept of CSE,Vemana IT 6 2021-2022
TRANSFORMERS DESIGN
3.2 Initialization
This function is the initial stage of the system where the system initializes the various aspects
of the graphics system based on the user requirements, which include Command line
processing, window system initialization and also the initial window creation state is controlled
by these routines.
3.3 Event Processing
This routine enters GLUT’s event processing loop. This routine never returns, and it
continuously calls GLUT call-back as and when necessary. This can be achieved with the help
of the call-back registration functions. These routines register call-backs to be called by the
GLUT event processing loop.
Dept of CSE,Vemana IT 7 2021-2022
TRANSFORMERS IMPLEMENTATION
CHAPTER 4
IMPLEMENTATION
1.4 OpenGL Functions Used:
This project is developed using Code Blocks and this project is implemented by making
extensive use of library functions offered by graphics package of OpenGL, a summary of those
functions follows:
glBegin() : Specifies the primitives that will be created from vertices presented between
glBegin and subsequent glEnd. GL_POLYGON, GL_LINE_LOOP etc.
glEnd(void) : It ends the list of vertices.
glPushMatrix() : void glPushMatrix( void ) glPushMatrix pushes the current matrix stack
down by one level, duplicating the current matrix.
glPopMatrix() : void glPopMatrix(void ) glPopMatrix pops the top matrix off the stack,
destroying the contents of the popped matrix. Initially, each of the stacks contains one
matrix, an identity matrix.
glTranslate() : void glTranslate(GLdouble x, GLdouble y, GLdouble z ) Translation is an
operation that displaces points by a fixed distance in a given direction. Parameters x, y, z
specify the x, y, and z coordinates of a translation vector. Multiplies current matrix by a
matrix that translates an object by the given x, y and z-values.
glClear() : void glClear(GLbitfield mask) glClear takes a single argument that is the
bitwise or of several values indicating which buffer is to be cleared.
GL_COLOR_BUFFER_BIT, GL_DEPTH_BUFFER_BIT, GL_ACCUM_
BUFFER_BIT, and GL_STENCIL_BUFFER_BIT. Clears the specified buffers to their
current clearing values.
glClearColor() : void glClearColor(GLclampf red, GLclampf green, GLclampf blue,
GLclampf alpha) Sets the current clearing color for use in clearing color buffers in RGBA
mode. The red, green, blue, and alpha values are clamped if necessary to the range [0,1].
The default clearing color is (0, 0, 0, 0), which is black.
glMatrixMode() : void glMatrixMode(GLenum mode) It accepts three values
GL_MODELVIEW, GL_PROJECTION and GL_TEXTURE. It specifies which matrix is
the current matrix. Subsequent transformation commands affect the specified matrix.
Dept of CSE,Vemana IT 8 2021-2022
TRANSFORMERS IMPLEMENTATION
glutInitWindowPosition() : void glutInitWindowPosition(int x, int y); This API will
request the windows created to have an initial position. The arguments x, y indicate the
location of a corner of the window, relative to the entire display.
glLoadIdentity() : void glLoadIdentity(void); It replaces the current matrix with the
identity matrix.
glutInitWindowSize() : void glutInitWindowSize(int width, int height); The API requests
windows created to have an initial size. The arguments width and height indicate the
window’s size (in pixels). The initial window size and position are hints and may be
overridden by other requests.
glutInitDisplayMode void glutInitDisplayMode(unsigned int mode ): Specifies the
display mode, normally the bitwise OR-ing of GLUT display mode bit masks. This API
specifies a display mode (such as RGBA or color-index, or single or double-buffered)for
windows.
glFlush() : void glFlush(void); The glFlush function forces execution of OpenGL functions
in finite time.
glutCreateWindow() : int glutCreateWindow(char *name); The parameter name specifies
any name for window and is enclosed in double quotes. This opens a window with the set
characteristics like display mode, width, height, and so on. The string name will appear in
the title bar of the window system. The value returned is a unique integer identifier for the
window. This identifier can be used for controlling and rendering to multiple windows
from the same application.
glutDisplayFunc() : void glutDisplayFunc(void (*func)(void)) Specifies the new display
callback function. The API specifies the function that’s called whenever the contents of the
window need to be redrawn. All the routines need to be redraw the scene are put in display
callback function.
glVertex2f void glVertex2f(GLfloatx,GLfloat y): x Specifies the x-coordinate of a
vertex. y Specifies the y-coordinate of a vertex. The glVertex function commands are used
within glBegin/glEnd pairs to specify point, line, and polygon vertices. The current color,
normal, and texture coordinates are associated with the vertex when glVertex is called.
When only x and y are specified, z defaults to 0.0 and w defaults to 1.0. When x, y, and z
are specified, w defaults to 1.0.
Dept of CSE,Vemana IT 9 2021-2022
TRANSFORMERS IMPLEMENTATION
glColor3f void glColor3f(GLfloat red, GLfloat green, GLfloat blue): PARAMETERS:
1. Red: The new red value for the current color. 2. Green: The new green value for the
current color. 3. Blue: The new blue value for the current color. Sets the current color.
glRotate(): void glRotate( GLfloat angle, GLfloat x, GLfloat y, GLfloat z);
PARAMETERS:
angle: The angle of rotation, in degrees.
x: The x coordinate of a vector.
y: The y coordinate of a vector.
z: The z coordinate of a vector.
The glRotated and glRotatef functions multiply the current matrix by a rotation matrix.
gluPerspective(): void gluPerspective( GLdouble fovy, GLdouble aspect, GLdouble
zNear, GLdouble zFar ); PARAMETERS:
fovy : Specifies the field of view angle, in degrees, in the y direction.
aspect: Specifies the aspect ratio that determines the field of view in the x direction. The
aspect ratio is the ratio of x (width) to y (height).
zNear: Specifies the distance from the viewer to the near clipping plane (always positive).
zFar : Specifies the distance from the viewer to the far clipping plane (always positive).
Sets up a perspective projection matrix.
glMaterialfv(): void glMaterialfv(GLenum face, GLenum pname, const GLfloat params);
PARAMETERS:
face : The face or faces that are being updated. Must be one of the following: GL_FRONT,
GL_BACK, or GL_FRONT and GL_BACK.
Pname: The material parameter of the face or faces being updated. The parameters that can
be specified using glMaterialfv, and their interpretations by the lighting equation, are as
follows.
GL_SPECULAR: The params parameter contains four integer or floating-point values that
specify the seculars RGBA reflectance of the material. Integer values are mapped linearly
such that the most positive represent able value maps to 1.0, and the most negative
represent able value maps to -1.0. Floating-point values are mapped directly. Neither
integer nor floating-point values are clamped. The default specular reflectance for both
front-facing and back-facing materials is (0.0, 0.0, 0.0, 1.0). The glMaterialfv function
specifies material parameters for the lighting model.
glutInit(): glutInit(int *argcp, char **argv); PARAMETERS:
Dept of CSE,Vemana IT 10 2021-2022
TRANSFORMERS IMPLEMENTATION
argcp : A pointer to the program's unmodified argc variable from main. Upon return, the
value pointed to by argcp will be updated, because glutInit extracts any command line
options intended for the GLUT library.
argv : The program's unmodified argv variable from main. Like argcp, the data for argv
will be updated because glutInit extracts any command line options understood by the
GLUT library.
glutInit(&argc,argv): glutInit is used to initialize the GLUT library.
glutMainLoop (): void glutMainLoop(void); glutMainLoop(); glutMainLoop enters the
GLUT event processing loop.
glEnable(): void glEnable(GLenum cap); glEnable(GL_CULL_FACE); PARAMETERS:
cap: A symbolic constant indicating an OpenGL capability. The glEnable enable OpenGL
capabilities.
DISPLAY FUNCTION
This function is used to display the main screen of the project.
Declaration:
void display()
{
switch(whichScene)
{
case 0: intro();
break;
case 1:ramzan();
break;
case 2:diwali();
break;
case 3:christmas();
break;
}
glFlush();
}
Dept of CSE,Vemana IT 11 2021-2022
TRANSFORMERS SNAPSHOTS
CHAPTER 5
SNAPSHOTS
Fig No.5.1 Introduction page
Fig 5.1 Shows the Introduction page for the Festival of India
Fig No.5.2 Ramzan
Fig 5.2 When input 1 is given then the output is Festival of Ramzan
Dept of CSE,Vemana IT 12 2021-2022
TRANSFORMERS SNAPSHOTS
Fig No.5.3 Diwali
Fig 5.3 Press 2 for displaying the Diwali Festival
Fig No.5.4 Christmas
Fig 5.4 Press 3 for displaying Christmas Festival.
Dept of CSE,Vemana IT 13 2021-2022
TRANSFORMERS REFERENCE
CONCLUSION AND FUTURE ENHANCEMENT
Conclusion
Our project aims at showing the Festivals of India in OpenGL. Using built in functions
provided by graphics library and integrating it with the C and C++.The lighting and material
functions of OpenGl library add effect to the objects in animation. Showing the different
Festivals of India in OpenGL. Using built in functions provided by graphics library and
integrating it with the C implementation, it was possible to visually represent the vertices and
faces of the 3D objects. The program is user friendly as the only skill required in executing
this program is the basic knowledge of Opengl. The aim in developing this program was to
design a simple program using Open GL application software by applying the skills we learnt
in class, and in doing so, to understand the algorithms and the techniques underlying interactive
graphics better. The designed program will incorporate all the basic properties that a simple
program must possess. The program is user friendly as the only skill required in executing this
program is the knowledge of graphics.
Future Enhancement
We can try to add more regional festivals of India
We can try to improve the quality of the object drawn.
Converting the entire 2D model to 3D model.
We can decorate the objects to our prospective.
Can add more functions like timer and mouse events
Dept of CSE,Vemana IT 14 2021-2022
TRANSFORMERS REFERENCE
REFERENCE
Books
Edward Angel’s Interactive Computer Graphics Pearson Education 5th Edition
Interactive computer Graphics --A top down approach using open GL--by Edward Angel.
Jackie.L.Neider,MarkWarhol,Tom.R.Davis,"OpenGL Red Book",Second Revised Edition,
2005.
Donald D Hearn and M.PaulineBaker,"Computer Graphics with OpenGL", 3rd Edition.
Websites
www.OpenGL Redbook.com
www.OpenGL simple examples.
www.OpenGL programming guide.
http://www.wikipedia.com
http://basic4gl.wikispaces.com
http://www.opengl.org
http://pyopengl.sourceforge.net/documentation/manual/glut.3GLUT.htm
Dept of CSE,Vemana IT 15 2021-2022