0% found this document useful (0 votes)
156 views21 pages

CG Mini Project

This document describes a mini-project report submitted by Jigyas Subedi and Sujan Bhattarai to fulfill requirements for a Computer Graphics and Visualization course. The project involves developing a 3D model of a table fan in C++ using OpenGL. The report includes an introduction to OpenGL, requirements analysis, design and implementation details, testing procedures, and screenshots of the table fan model at different stages of rotation. Keyboard input is used to control the rotation of the fan blades. The overall aim is to create an interactive 3D simulation of a table fan.

Uploaded by

Sujan Bhattarai
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
156 views21 pages

CG Mini Project

This document describes a mini-project report submitted by Jigyas Subedi and Sujan Bhattarai to fulfill requirements for a Computer Graphics and Visualization course. The project involves developing a 3D model of a table fan in C++ using OpenGL. The report includes an introduction to OpenGL, requirements analysis, design and implementation details, testing procedures, and screenshots of the table fan model at different stages of rotation. Keyboard input is used to control the rotation of the fan blades. The overall aim is to create an interactive 3D simulation of a table fan.

Uploaded by

Sujan Bhattarai
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 21

VISVESVARAYA TECHNOLOGICAL UNIVERSITY

“JnanaSangama”, Belagavi-590014, Karnataka, India

MINI-PROJECT REPORT ON
“Table Fan”
Submitted in partial fulfilment of the requirements of
COMPUTER GRAPHICS AND VISUALIZATION
for the Sixth Semester Bachelor of Engineering Degree

SUBMITTED BY
JIGYAS SUBEDI (1IC19CS011)
SUJAN BHATTARAI (1IC19CS020)

Under the guidance of


Geetha M.
Assistant Professor
Department of CS&E

IMPACT COLLEGE OF ENGINEERING AND APPLIED SCIENCE


SAHAKAR NAGAR, BANGALORE-560092

2021-2022
IMPACT COLLEGE OF ENGINEERING AND APPLIED SCIENCES
SAHAKARNAGAR, BANGALORE -560092

DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING

CERTIFICATE
This is to certify that the project entitled "Table Fan" carried out by Mr. Jigyas Subedi
[1IC19CS011] and Mr. Sujan Bhattarai [1IC19CS020] bonafide students of Impact
College of Engineering and Applied Sciences have been submitted in partial fulfillment
of requirements in Computer Graphics and its Visualization of VI semester Bachelor of
Engineering degree in Computer Science & Engineering as prescribed by
VISVESVARAYA TECHNOLOGICAL UNIVERSITY during the academic year of
2021-2022.

Signature of the Guide Signature of HOD


Mrs. Geetha M. Dr. Dhananjaya V
Assistant Professor Professor & HOD
Dept. of CS&E Dept. of CS&E

Name of Examiner Signature with date

1. 1.

2. 2.
ACKNOWLEDGEMENT

The successful completion of this project was made possible with the help and
guidance received by us from the various quarters. We would like to avail this
opportunity to express our sincere gratitude to all of them.

We are grateful to our guide Mrs. Geetha M. for her keen interest and
encouragement in our project, their guidance and cooperation helped us in nurturing
the project in reality.

We would like to sincerely thank Dr. Dhananjaya V, Head of Department,


Computer Science and Engineering for his support and guidance.

We thank the management Dr. K.P Mathula and our Principal Dr. A.N Khaleel
Ahmed for providing us with necessary infrastructure and a good environment to
nourish our knowledge.

I am also in debt to my parents and friends for their continued moral and material
support throughout the course of the assessment and in helping me finalize the
assignment.

My heartfelt thanks to all the people who have contributed to accomplish this
assignment.

JIGYAS SUBEDI (1IC19CS011)

SUJAN BHATTARAI (1IC19CS020)

i
ABSTRACT
Aim of this project is to develop a Table Fan using C++ and OpenGL (Open
Graphics Library). Open Graphics Library is a cross-language, cross-platform
application programming interface for rendering 2D and 3D vector graphics. In
this demonstration, user can see the table fan which is made up of different
constituent. At the bottom, there is fan base above that fan stand and motor are
present respectively. Fan blades are attached with the motor. This project has been
developed in Windows OS with keyboard interface. On pressing space button
from keyboard, blade starts rotating and stops rotating alternatively.

ii
CONTENTS
ACKNOWLEDGEMENT i

ABSTRACT ii

CHAPTER NO. TITLE Pg No.

Chapter 1 INTRODUCTION

1.1 Introduction to OpenGL 01

1.2 Interfaces 02

Chapter 2 REQUIREMENTS ANALYSIS


2.1 Hardware/Software Analysis 03

Chapter 3 ANALYSIS AND DESIGN

3.1 Window Design 04

3.2 Simulation Display 04

Chapter 4 IMPLEMENTSTION

4.1 Functions used 05

4.2 Technical Feasibility 07

Chapter 5 TESTING

5.1 Unit Testing 08

5.2 Integration Testing 08

5.3 System Testing 08

5.4 User Acceptance Testing 08

Chapter 6 SNAPSHOTS

6.1 Home Screen 10

6.2 Rotating Stage 11

6.3 Rest Stage 12

CONCLUSION 13

REFERENCES 14

iii
LIST OF FIGURES

FIG NO. FIGURE NAME


Pg No.
1.1 OpenGL Demo using C++ 01

3.1 Window Design 04

3.2 Simulation Display 04

6.1 Home Screen 10

6.2 Rotating Stage 11

6.3 Rest Stage 12

iv
Table Fan

CHAPTER 1
INTRODUCTION

1.1 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.

1.2 OpenGL

OpenGL is an open specification for an applications program interface for defining 2D and 3D
objects. The specification is cross-language, cross-platform API for writing applications that
produce 2D and 3D computer graphics. It renders 3D objects to the screen, providing the same
set of instructions on different computers and graphics adapters. Thus, it allows us to write an
application that can create the same effects in any operating system using any OpenGL-adhering
graphics adapter.

Fig 1.1: OpenGL Demo using C++

Dept. of CS&E, ICEAS 2021-22 01


Table Fan

Computer graphics, a 3-dimensional primitive can be anything from a single point to an n- sided
polygon. From the software standpoint, primitives utilize the basic 3- dimensional rasterization
algorithms such as Bresenham's line drawing algorithm, polygon scan line fill, texture mapping
and so forth. OpenGL's basic operation is to accept primitives such as points, lines and polygons,
and convert them into pixels. This is done by a graphics pipeline known as the OpenGL state
machine. Most OpenGL commands either issue primitives to the graphics pipeline, or configure
how the pipeline processes these primitives. OpenGL is a low-level, procedural API, requiring
the programmer to dictate the exact steps required to render a scene. OpenGL's low-level design
requires programmers to have a good knowledge of the graphics pipeline, but also give a certain
amount of freedom to implement novel and rendering algorithms.

GLUT

GLUT, short for OpenGL Utility Toolkit, is a set of support libraries available on every major
platform. OpenGL does not directly support any form of windowing, menus, or input. That's
where GLUT comes in. It provides basic functionality in all of those areas, while remaining
platform independent, so that you can easily move GLUT-based applications from, for example,
Windows to UNIX with few, if any, changes.

1.2 Interfaces
A user interface, consisting of the set of dials, knobs, operating system commands, graphical
display formats, and other devices provided by a computer or a program to allow the user to
communicate and use the computer or program.
Keyboard Interface
A keyboard interface allows users to provide keystroke input to programs even if the native
technology does not contain a keyboard.
One functionality is implemented using the keyboard function.
 If a user presses spacebar, the fan blade starts rotating.
 And again, if user presses spacebar, then fan blade stops rotating.

Dept. of CS&E, ICEAS 2021-22 02


Table Fan

CHAPTER 2

REQUIREMENT ANALYSIS
2.1 Hardware/Software Requirements:

The Hardware requirements are

 Processor: Intel 486/Pentium processor or above

 Hard Disks: 10MB

 RAM: 512 MB and above

 Monitor Resolution: Color monitor with minimum resolution of 1024*720

The Software Specification are

 An MS-DOS based operating system like Windows 7 and above.

 A Visual C/C++ compiler such as Dev-C++

 A built-in graphics library like glut and glut32, and header file like GL\glut.h and also
dynamic link libraries like glut and glut32 are required for creating the 3D layout.

Dept. of CS&E, ICEAS 2021-22 03


Table Fan

CHAPTER 3

ANALYSIS AND DESIGN


3.1 Window Design

Table fan uses only one window. That is Table Fan (Main window): This window contains
simulation display. This is window used for all the events and functions in this project. In this
window, we display simulation of fan where start and stop are done. And keyboard events
triggered in this window.

Fig 3.1: Window Design

3.2 Simulation Display


As user presses the space button, fan blade starts rotating and again pressing space button fan
blade stops.

Dept. of CS&E, ICEAS 2021-22 04


Table Fan

Fig 3.2: Simulation Display

Dept. of CS&E, ICEAS 2021-22 04


Table Fan

CHAPTER 4
IMPLEMENTATION
4.1 Function Used
glutKeyboardFunc(args): glutKeyboardFunc sets the keyboard callback for the current
window. When a user types into the window, each key press generating an ASCII character will
generate a keyboard callback. The key callback parameter is the generated ASCII character. The
state of modifier keys such as Shift cannot be determined directly; their only effect will be on the
returned ASCII data. The x and y callback parameters indicate the mouse location in window
relative coordinates when the key was pressed. When a new window is created, no keyboard
callback is initially registered, and ASCII key strokes in the window are ignored. Passing NULL
to glutKeyboardFunc disables the generation of keyboard callbacks. During a keyboard callback,
glutGetModifiers may be called to determine the state of modifier keys when the keystroke
generating the callback occurred. callback was due to a release or press respectively. The x and y
callback parameters indicate the window relative coordinates when the mouse button state
changed. If a GLUT_DOWN callback for a specific button is triggered, the program can assume
a GLUT_UP callback for the same button will be generated (assuming the window still has a
mouse callback registered) when the mouse button is released even if the mouse has moved
outside the window.
glutCreateWindow: It creates a top-level window. The name will be provided to the window
system as the window's name. The intent is that the window system will label the window with
the name. Implicitly, the current window is set to the newly created window. Each created
window has a unique associated OpenGL context. State changes to a window's associated
OpenGL context can be done immediately after the window is created. The display state of a
window is initially for the window to be shown. But the window's display state is not actually
acted upon until glutMainLoop is entered. This means until glutMainLoop is called, rendering to
a created window is ineffective because the window cannot yet be displayed.
glutDisplayFunc: It sets the display callback for the current window. When GLUT determines
that the normal plane for the window needs to be redisplayed, the display callback for the
window is called. Before the callback, the current window is set to the window needing to be
redisplayed and (if no overlay display callback is registered) the layer in use is set to the normal
plane. The display callback is called with no parameters. The entire normal plane region should
be redisplayed in response to the callback (this includes ancillary buffers if your program
depends on their state).

Dept. of CS&E, ICEAS 2021-22 05


Table Fan

glutReshapeFunc: It sets the reshape callback for the current window. The reshape callback is
triggered when a window is reshaped. A reshape callback is also triggered immediately before a
window's first display callback after a window is created or whenever an overlay for the window
is established. The width and height parameters of the callback specify the new window size in
pixels. Before the callback, the current window is set to the window that has been reshaped.

gluLookAt: gluLookAt creates a viewing matrix derived from an eye point, a reference point
indicating the center of the scene, and an UP vector. The matrix maps the reference point to the
negative z axis and the eye point to the origin.

glTranslatef: The glTranslatef function produces the translation specified by (x, y, z). The
translation vector is used to compute a 4x4 translation matrix: The current matrix (see
glMatrixMode) is multiplied by this translation matrix, with the product replacing the current
matrix.

glRotatef: The glRotatef function computes a matrix that performs a counterclockwise rotation


of angle degrees about the vector from the origin through the point (x, y, z). The current matrix
(see glMatrixMode) is multiplied by this rotation matrix, with the product replacing the current
matrix.

glPopMatrix: The glPopMatrix function pops the current matrix stack, replacing the current
matrix with the one below it on the stack. Initially, each of the stacks contains one matrix, an
identity matrix.

glPushMatrix: glPushMatrix pushes the current matrix stack down by one, duplicating the
current matrix. That is, after a glPushMatrix call, the matrix on top of the stack is identical to the
one below it. glPopMatrix pops the current matrix stack, replacing the current matrix with the
one below it on the stack.

glMatrixMode: glMatrixMode sets the current matrix mode. Mode can assume one of four
values:

 GL_MODELVIEW: Applies subsequent matrix operations to the modelview matrix


stack.
 GL_PROJECTION: Applies subsequent matrix operations to the projection matrix stack.
 GL_TEXTURE: Applies subsequent matrix operations to the texture matrix stack.
 GL_COLOR: Applies subsequent matrix operations to the color matrix stack.

Dept. of CS&E, ICEAS 2021-22 06


Table Fan

4.2 Technical Feasibility


Technical feasibility is one of the first studies that must be conducted after the project has been
identified. In Technical Feasibility current resources both hardware software along with required
technology are analyzed/assessed to develop project. This technical feasibility study gives report
whether there exists correct required resources and technologies which will be used for project
development. Along with this, feasibility study also analyzes technical skills and capabilities of
technical team, existing technology can be used or not, maintenance and up-gradation is easy or
not for chosen technology etc.

Determining the Requirements of the Project is also a part of Technical Feasibility. It involves
finding components that are requires for the project.

Dept. of CS&E, ICEAS 2021-22 07


Table Fan

CHAPTER 5

TESTING

5.1 Unit Testing

Unit testing mainly focuses on the smallest unit of software design. In this, we test an individual
unit or group of interrelated units. It is often done by the programmer by using sample input and
observing its corresponding outputs. It also verifies that the codes are efficient and adheres to the
adopted coding standards. It is done using the unit test design.
5.2 Integration Testing
Once we are successfully implementing the unit testing, we will go integration testing. It is the
second level of functional testing, where we test the data flow between dependent modules or
interface between two features is called integration testing. The purpose of executing the
integration testing is to test the statement's accuracy between each module.
5.3 System Testing
System Testing includes testing of a fully integrated software system. Generally, a computer
system is made with the integration of software (any software is only a single element of a
computer system). The software is developed in units and then interfaced with other software
and hardware to create a complete computer system. In other words, a computer system consists
of a group of software to perform the various tasks, but only software cannot perform the task;
for that software must be interfaced with compatible hardware. System testing is a series of
different type of tests with the purpose to exercise and examine the full working of an integrated
software computer system against requirements.

6.4 User Acceptance Testing

Acceptance testing is formal testing based on user requirements and function processing. It
determines whether the software is conforming specified requirements and user requirements or
not. It is conducted as a kind of Black Box testing where the number of required users involved
testing the acceptance level of the system. It is the fourth and last level of software testing.

User acceptance testing (UAT) is a type of testing, which is done by the customer before
accepting the final product. Generally, UAT is done by the customer (domain expert) for their
satisfaction, and check whether the application is working according to given business scenarios,
real-time scenarios.

Dept. of CS&E, ICEAS 2021-22 08


Table Fan

In this, we concentrate only on those features and scenarios which are regularly used by the
customer or mostly user scenarios for the business or those scenarios which are used daily by the
end-user or the customer.
Reasons behind the acceptance testing

• During the development of a project if there are changes in requirements and it may not be
communicated effectively to the development team.
• Developers develop functions by examining the requirement document on their own
understanding and may not understand the actual requirements of the client.
• There're maybe some minor errors which can be identified only when the system is used by
the end user in the actual scenario so, to find out these minor errors, acceptance testing is
essential.

Dept. of CS&E, ICEAS 2021-22 09


Table Fan

CHAPTER 6

SNAPSHOTS

6.1 Home Screen

Fig 6.1: Home Screen

This shows the entire fan located at center and display message within the window.

Dept. of CS&E, ICEAS 2021-22 10


Table Fan

6.2 Rotating Stage

Fig 6.2: Rotating Stage

This shows the rotating stage of the fan, when user press spacebar the fan starts rotating.

Dept. of CS&E, ICEAS 2021-22 11


Table Fan

6.3 Rest Stage

Fig 6.3: Rest Stage

This shows the rest stage of the fan, when user press spacebar the fan stops rotating.

Dept. of CS&E, ICEAS 2021-22 12


Table Fan

CONCLUSION

Table fan was created by us to meet the requirement of the mini project by which we got to
explore C++ and OpenGL. In this project, we got to explore many more things and came up with
practical use of our knowledge. We had a good experience with the work and used ideas and
knowledge to create this project. Our idea was to build a realistic table fan to meet the real-world
requirement and further we would like to work on many more on our project.

Dept. of CS&E, ICEAS 2021-22 13


Table Fan

REFERENCES

[1].Interactive Computer Graphics a Top-Down Approach with OpenGL - Edward Angel, 5 th


Edition, Addison-Wesley, 2008.

[2].Computer Graphics Using OpenGL – F.S. Hill Jr. 2nd Edition, Pearson Education, 2001.

[3].Computer Graphics - OpenGL Version – Donald Hearn and Pauline Baker, 2nd Edition, Pearson
Education, 2003

[4].www.opengl.org

Dept. of CS&E, ICEAS 2021-22 14

You might also like