You are on page 1of 26

VISVESVARAYA TECHNOLOGICAL UNIVERSITY

“Jnana Sangama”, Belagavi-590018, Karnataka

A CG Mini Project Report on

“STEAM ENGINE”
Submitted in partial fulfilment of the requirement for the award of degree of
Bachelor of Engineering
In
Computer Science and Engineering
Submitted by
YASHASWINI K.S
(4NN17CS047)
VINUTHA R
(4NN18CS411)
Under the Guidance of

Mr. Ajay A V.
Assistant Professor
Dept. of CS & Engineering

Department of Computer Science and Engineering


NIE Institute of Technology
Mysuru -570018
2019-20
Department of Computer Science and Engineering
NIE Institute of Technology

CERTIFICATE
This is to certify that the mini project entitled “STEAM ENGINE” is carried out by
YASHASWINI K.S and VINUTHA R bearingUSN:4NN17CS047,4NN18CS411 respectively
in the partial fulfilment for the Fifth semester of Bachelor of Engineering degree in
Computer Science and Engineering of the Visvesvaraya Technological University,
Belagavi during the academic year 2019-20. The project report has been approved as it
satisfies the academic requirements with respect to project work prescribed for the Bachelor
of Engineering.

Signature of the Guide Signature of the HOD

Mr. Ajay A V. Smt. Vedavathi N


Assistant Professor, Assistant Professor & Head,
Dept. of CS & Engineering Dept. of CS & Engineering
NIEIT, Mysuru NIEIT, Mysuru

External Viva

Name of the examiners Signature with Date

1…………………….... 1……………………….

2………………………. 2 ………………………
ACKNOWLEDGEMENT

The satisfaction and euphoria that accompany the successful completion of any task
would be incomplete without the mention of the people who made it possible, whose
consistent guidance and encouragement crowned our efforts with success.

We consider ourselves proud to be a part of NIE Institute of Technology Mysuru family,


the institution which stood by our side in all our endeavours.

We wish to express our gratitude to Prof. Bansilal, Principal, NIE Institute of Technology
Mysuru, for providing a congenial working environment.

We express our sincere thanks to Smt. Vedavathi N, Assistant Professor and Head,
Department of Computer Science and Engineering, for her support and encouragement.

We would like to thank our guide, Mr. Ajay A V. Assistant Professor, Department of
Computer Science and Engineering, for his inspiration, guidance, constant supervision,
direction and discussions in the successful completion of this project work.

We are thankful to the Department of Computer Science and Engineering staff members and
non-staff members for their co-operation extended towards this work.

Finally, our heartfelt gratitude to our family members, relatives and friends for their
constant support, motivation and encouragement throughout this project. Above all we would
like to thank God Almighty, for having showered his blessings on us.

YASHASWINI
K.S (4NN17CS047)
VINUTHA R (4NN18CS411)
ABSTRACT

AIM: The aim of the project is to create a STEAM ENGINE.A steam engine uses
heat and steam to create mechanical power.

A steam engine is a heat engine that performs mechanical work using steam as its working
fluid.There have been many different types of steam engines throughout history;some use
wood and others use coal to generate the necessary steam.Most steam engines work by
heating water in a chamber,which creates or holds steam.The pressure of the steam can then
be directed through pipes and valves to generate mechanical power.Steam engines have been
applied to a wide range of uses.The first steam engines were simple pumps used to remove
water from mineshafts.After some improvements,more efficient and powerful steam engines
were being used to power trains,ships,and entire factories.
LIST OF CONTENTS

CHAPTERS PAGE NO.


1. Introduction
1.1 Computer Graphics 1
1.2 OpenGL Interface 1
1.2.1 OpenGL Pipeline Architecture 2
1.2.2 OpenGL Overview 3
2. System Requirements And Specification
2.1 Hardware Requirements 5
2.2 Software Requirements 5
2.3 Functional Requirements 5
3. About The Project
3.1 Overview 7
3.2 User Interface 8
3.3 Objective 8
3.4 Benefits 8
4. Software Design 9
5. Implementation
5.1 User defined functions 11
5.2 OpenGL functions 11
6. Testing
6.1 Introduction to testing 13
6.2 Stages in the implementation of testing 13
6.3 Result 14
7. Snapshots 15
8. conclusion Future enhancement 18
LIST OF FIGURES AND TABLES

1. FIGURES PAGE NO.


Figure 7.1 The Initial Screen Of The Project 15
Figure 7.2 Simple Village Day Mode 15
Figure7.3 Simple Village Night Mode 16
Figure 7.4 Simple City Day Mode 16
Figure 7.5 Simple City Night Mode 17
Figure 7.6 City In Night Mode With Light Off And Comet 17
2. TABLES
Table 6.3 Testing for the ‘Simple Village And City’ Project 14
Steam Engine 2019-20

CHAPTER 1
INTRODUCTION
First Come First Serve Algorithm is OS based
Computer graphics Project. This Project as name
suggest demonstrate the working of First Come First
Serve Algorithm or FCFS Algorithm. The objects are
drawn using the GLUT functions. This project has been
developed using Code::Blocks IDE on Windows 10
operating system with OpenGL package.

1.1 Computer Graphics

Graphics provides one of the most natural


means of communicating within a computer
since our highly developed 2D and 3D pattern-
recognition abilities allow us to perceive and
process pictorial data rapidly and effectively.
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.

Computer graphics started with the display of


data on hard copy plotters and cathode
ray tube screens soon after the introduction of computers
themselves. It has grown to include the creation, storage,
and manipulation of models and images of objects. These
models come from a diverse and expanding set of fields,
and include physical, mathematical, engineering,
architectural, and even conceptual structures, natural
phenomena, and so on.
Dept of CSE, NIE-IT Mysuru Page 1
Steam Engine 2019-20

Co the handling of such devices is included in the study of


mputer computer graphics. The advantages of the interactive
graphics graphics are many in number. Graphics provides one of
today is the most natural means of communicating with a
largely computer, since our highly developed 2D and 3D
interactive pattern-recognition abilities allow us to perceive and
. The user process data rapidly and efficiently. In many design,
controls implementation, and construction processes today, the
the information pictures can give is virtually indispensable.
contents,
structure,
and
appearanc
e of the
objects
and of
their
displayed
images by
using
input
devices,
such as
keyboard,
mouse, or
touch-
screen.
Due to
close
relationshi
ps
between
the input
devices
and the
display,
Dept of CSE, NIE-IT Mysuru Page 2
Scientific visualization became an important field in the 1980s when the scientists and
engineers realized that they could not interpret the prodigious quantities of data produced in
supercomputer runs without summarizing the data and highlighting trends and phenomena in
various kinds of graphical representations.

1.2 OpenGL Interface


OpenGL is an application program interface (API) offering various functions to
implement primitives, models and images. This offers functions to create and manipulate
render lighting, coloring, viewing the models. OpenGL offers different coordinate system
and frames. OpenGL offers translation, rotation and scaling of objects. Most of our
applications will be designed to access OpenGL directly through functions in three
libraries. They are:

1. Main GL: Library has names that begin with the letter gl and are stored in
a library usually referred to as GL.
2. OpenGL Utility Library (GLU): This library uses only GL functions but
contains code for creating common objects and simplifying viewing.
3. OpenGL Utility Toolkit (GLUT): This provides the minimum functionality that
should be accepted in any modern windowing system.

1.2.1 OpenGL Pipeline Architecture


Many OpenGL functions are used specifically for drawing objects such as points,
lines, polygons, and bitmaps. Some functions control the way that some of this drawing
occurs (such as those that enable antialiasing or texturing). Other functions are
specifically concerned with frame buffer manipulation. The topics in this section describe
how all of the OpenGL functions work together to create the OpenGL processing pipeline.
This section also takes a closer look at the stages in which data is actually processed, and
ties these stages to OpenGL functions.
The following diagram details the OpenGL processing pipeline. For most of the
pipeline, you can see three vertical arrows between the major stages. These arrows
represent vertices and the two primary types of data that can be associated with
vertices: color values and texture coordinates. Also note that vertices are assembled
into primitives, then into fragments, and finally into pixels in the frame buffer. This
progression is discussed in more detail in Vertices, Primitives, Fragments, and
Pixels.
Figure. 1.1 OpenGL Pipeline Architecture

1.2.2 OpenGL Overview [2]

● OpenGL (Open Graphics Library) is the interface between a graphic program and
graphics hardware. It is streamlined. In other words, it provides low-level
functionality. For example, all objects are built from points, lines and convex
polygons. Higher level objects like cubes are implemented as six four-sided
polygons.
● OpenGL supports features like 3-dimensions, lighting, anti-aliasing, shadows,
textures, depth effects, etc.
● It is system-independent. It does not assume anything about hardware or operating
system and is only concerned with efficiently rendering mathematically described
scenes. As a result, it does not provide any windowing capabilities.
● It is a state machine. At any moment during the execution of a program there is a
current model transformation.
● It is a rendering pipeline. The rendering pipeline consists of the following steps:
○ Defines objects mathematically.
○ Arranges objects in space relative to a viewpoint.
○ Calculates the color of the objects.
○ Rasterizes the objects.
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 (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 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.

OpenGL serves two main purposes:


● To hide the complexities of interfacing with different 3D accelerators, by
presenting programmer with a single, uniform API
● To hide the differing capabilities of hardware platforms, by requiring that all
Implementations support the full OpenGL, feature set.
OpenGL has historically been influential on the development of 3D accelerator, promoting
a base level of functionality that is now common in consumer level hardware:
● Rasterized points, lines and polygons are basic primitives.
● A transform and lighting pipeline.
● Z buffering.
● Texture Mapping.
● Alpha and blending.
Chapter 2
SYSTEM REQUIREMENTS SPECIFICATIONS
2.1 HARDWARE REQUIREMENTS

● Processor : PentiumPC
● RAM : 512MB
● Hard Disk : 20 GB(approx)
● Display : VGA ColorMonitor
● Keyboard: QWERTY Keyboard
● Mouse : 2 or 3 Buttonmouse

2.2 SOFTWARE REQUIREMENTS

● Programming language – C++ using OpenGL


● Operating system – Windows98SE/2000/XP/Vista/UBUNTU
● Compiler : Eclipse/Microsoft Visual studio2005
● Graphics library – GL/glut.h
● OpenGL 2.0.

2.3 FUNCTIONAL REQUIREMENTS

 OpenGL APIs:
If we want to have a control on the flow of program and if we want to interact
with the window system then we use OpenGL API’S. Vertices are represented in the
same manner internally, whether they are specified as two-dimensional or three-
dimensional entities, everything that we do are here will be equally valid in three
dimensions. Although OpenGL is easy to learn, compared with other APIs, it is
nevertheless powerful. It supports the simple three-dimensional programs and also
supports the advanced rendering techniques.

 GL/glut.h:
We use a readily available library called the OpenGL Utility Toolkit (GLUT),
which provides the minimum functionality that should be expected in any modern
windowing system. The application program uses only GLUT functions and can be
recompiled with the GLUT library for other window system. OpenGL makes a heavy
use of macros to increase code readability and avoid the use of magic numbers. In
most implementation, one of the include lines.

 Code::Blocks Integrated Development Environment (IDE):


Code::Blocks is a free, open-source cross-platform IDE that supports multiple
compilers including GCC, Clang and Visual C++. It is developed in C++ using
wxWidgets as the GUI toolkit. Using a plugin architecture, its capabilities and features
are defined by the provided plugins. Currently, Code::Blocks is oriented towards C, C++,
and FORTRAN. It has a custom build system and optional Make support. Code::Blocks is
being developed for Windows, Linux, and MacOS and has been ported to FreeBSD,
OpenBSD and Solaris.

CHAPTER 3
ABOUT THE PROJECT
The aim of this project is to create a STEAM ENGINE.The Engine is made up
of a Piston,Engine Pole,Cylinder Head,Flywheel,Crank Bell and a Crank.The viewer is allowed
to rotate the Engine’s Crank either in clock wise or in anti-clock wise direction.The viewer can
also slow up or slow down the Crank speed.

3.1 Overview
First a Piston,Engine Pole, Cylinder Head, Flywheel, Crank Bell and a Crank is
created using myCylinder( ) function. The main primitives used inside the myCylinder( )
function to create a Cylinder is gluCylinder( ) and gluDisk( ) . So every time, myCylinder( )
function is called inside the functions used to create Piston, Engine Pole, Cylinder Head,
Flywheel, Crank Bell and Crank. The parts mentioned above are combined to form a Steam
Engine image. We can make Steam Engine transparent and display. In display function, at first
it clears the drawing buffer and if transparency is set, displays the model twice, first time
accepting those fragments with a ALPHA value of 1 only, then with DEPTH_BUFFER writing
disabled for those with other values. Initially when the animation is not called, the crank angle
will not change and the window is idle. When called increments the crank angle by
ANGLE_STEP, updates the head angle and notifies the system that the screen needs to be
updated. When a menu option has been selected, it translates the menu item identifier into a
keystroke, then calls the keyboard function. A menu will be associated with the mouse too. The
viewer can also see the shaded and textured steam engine

The controls are:-

 ‘a’ - > To rotate crank anti-clock wise.

 ‘z’ - > To rotate crank clock wise.

 ‘+’ and ‘-‘ - > To speed up and speed down

 ‘o’ - > Transparency.

 ‘0’ and 1’ - > Right light and Left light respectively

 ‘s’ and ‘t’ - > Shading and Texturerespectively

CHAPTER 4

CHAPTER 5

IMPLEMENTATION
5.1:Keyboard function.
5.2:Display function.

5.3:Reshape function.

5.1:Keyboard function:

KEYBOARD
FUNCTION

case 's': case 't': case 'a':

if (shaded == FALSE) if (texture == FALSE) if ((crank_angle += crank_step) >= 360)

{ shaded = TRUE; { texture = TRUE; crank_angle = 0;

glShadeModel(GL_SMOOTH); glEnable(GL_TEXTURE_2D); head_angle =


head_look_up_table[crank_angle];
glEnable(GL_LIGHTING); gluQuadricTexture(obj, GL_TRUE);
break;
glEnable(GL_DEPTH_TEST); }
case 'z':
KEYBOARD FUNC
(contd)

case '1': case ' ':

if (light2) { glDisable(GL_LIGHT1); light2 = FALSE; if (anim) { glutIdleFunc(0); anim = FALSE;


}
} else { glEnable(GL_LIGHT1); light2 = TRUE;
}
else { glutIdleFunc(animation); anim = TRUE;
}
break; case '4':

if ((view_h -= ANGLE_STEP) <= 0) view_h = 360; break; break; case '+':


case '6':
if ((++crank_step) > 45) crank_step = 45;

if ((view_h += ANGLE_STEP) >= 360) view_h = 0; break; case '-':

break; case '8': if ((--crank_step) <= 0) crank_step = 0;

if ((view_v += ANGLE_STEP) >= 360) view_v = 0; break; default:


return;
break; case '2':

if ((view_v -= ANGLE_STEP) <= 0) view_v = 360;


break;
5.2:Display function:

DISPLAY
FUNCTI0N

glPushMatrix(); if (transparent) {

glEnable(GL_ALPHA_TEST); pass = 2;
} draw_engine_pole(); glPushMatrix(); glTranslatef(0.5, 1.4,

0.0); draw_cylinder_head(); glPopMatrix();


else { glDisable(GL_ALPHA_TEST); pass = 0;
}

glPushMatrix(); glTranslatef(0.0, -0.8, 0.0); draw_crank();

glRotatef(view_h, 0, 1, 0); glPopMatrix();

glRotatef(view_v, 1, 0, 0); } while (pass > 0); glDepthMask(GL_TRUE);

glutSwapBuffers(); glPopMatrix();

do {

if (pass == 2) { glAlphaFunc(GL_EQUAL, 1);

glDepthMask(GL_TRUE); pass--;

} else if (pass != 0) { glAlphaFunc(GL_NOTEQUAL, 1);

glDepthMask(GL_FALSE);
pass--;
5.3:Reshape function:

RESHAPE
FUNCTION

glViewport(0, 0, w, h); glMatrixMode(GL_PROJECTION); glLoadIdentity();

gluPerspective(65.0, (GLfloat) w / (GLfloat) h, 1.0, 20.0);

glMatrixMode(GL_MODELVIEW);

glLoadIdentity(); glTranslatef(0.0, 0.0, -5.0);


glScalef(1.5, 1.5, 1.5);
CHAPTER 6
TESTING

6.1 Introduction to Testing


Verification and validation is a generic name given to checking processes, which
ensures that the software conforms to its specifications and meets the demands of users.
● Validation
Are we building the right product? Validation involves checking that the program
has implanted meets the requirement of the users.
● Verification
Are we building the product right? Verification involves checking that the
program confirms to its specification.

6.2 Stages in the Implementation of Testing


 Unit testing
Each individual unit is tested for correctness. These individual components
will be tested to ensure that they operate correctly.
● Module Testing
A module is a collection of dependent components such as a function. A
module encapsulates related components so can test without other system
modules.
● Sub-system Testing
This phase involves testing collection of modules, which have been integrated
into sub-systems. Sub-systems may be independently designed and implemented.
● System testing
The sub-systems are integrated to make up the entire system. The errors that
result from unanticipated interaction between sub-systems and system
components are removed.
● Acceptance testing
This is the final stage in the testing process before the system is tested for
operational use. Any requirement problem or requirement definition problem
revealed from acceptance testing are considered and made error free.
 Test plan
Careful planning is needed to the most of testing and controlled testing cost.
CHAPTER 7
SNAPSHOTS.

7.1: Initial
View

7.2: Menu associated with Right Mouse Button


7.3: Rotating Steam Engine

7.4: Shading
7.5: Texture

7.6: No Light(Transparency)
Simple Village and City 2019-20

Dept of CSE, NIE-IT Mysuru Page 15


CHAPTER 8
CONCLUSION AND FUTURE SCOPE

This project allows the user to rotate the piston in a Steam Engine. Its like a Miniature Steam Engine
Simulation.

Future scope:

1. SIMULATOR
Not only the movement of piston, we can make the whole parts in the steam engine
working so that it will be a simulator of steam engine. By modifying this project we can construct a
fully fledged simulator. Students who are studying about the steam engine can work through this and
it will be very helpful for them. Almost a complete picturization of a steam engine can be done
through this.

2. DESIGN OF STEAM ENGINES


Engineers who build Steam Engines can design their model by looking this
project. They get a good picturization by seeing this and it will be helpful for them in building
steam engines. So this project will be benefited by Engineers
BIBLIOGRAPHY

Books:
1. Edward Angel’s Interactive Computer Graphics Pearson Education,A Top-Down

Approach with OpenGL -5th Edition,Addison-Wesley,2008


2. Computer Graphics Using OpenGL – F.S. Hill, Jr. 2nd Edition, Pearson
Education, 2001.
3. Computer Graphics – James D Foley, Andries Van Dam, Steven K
Feiner, John F Hughes, Addison-Wesley 1997.
4. Computer Graphics - OpenGL Version – Donald Hearn and Pauline
Baker, 2nd Edition, Pearson Education, 2003.
5. The Official Guide to Learning OpenGL,by Jackie Neider,Tom Davis,Mason

Woo(THE REDBOOK).

6. OpenGL Super Bible by Richard S.Wright,Jr.and manpages.

Websites for reference


7. http://www.cs.rutgers.edu/~decarlo/428/glman.html
8. http://www.opengl.org

9. Wikipedia.org

You might also like