You are on page 1of 38

RAIN WATER HARVESTING 2016-17

CHAPTER 1

INTRODUCTION

Water is essential to all life forms on earth - human, animal and vegetation. It is
necessary to save water. Development of water supplies should, however, be undertaken
in such a way as to preserve the hydrological balance and the biological functions of our
ecosystems.

Consequently, the human Endeavour in the development of water sources must be


within the capacity of nature to replenish and to sustain. If this is not done, costly
mistakes can occur with serious consequences. The application of innovative technologies
and the improvement of indigenous ones should therefore include management of the
water sources to ensure sustainability and to safeguard the sources against pollution. As
land pressure rises, cities are growing vertical and in countryside more forest areas are
encroached and being used for agriculture. In India the small farmers depend on Monsoon
where rainfall is from June to October and much of the precious water is soon lost as
surface runoff. While irrigation may be the most obvious response to drought, it has
proved costly and can only benefit a fortunate few. There is now increasing interest in the
low cost alternative-generally referred to as 'Rain Water Harvesting' (RWH).

Water harvesting is the activity of direct collection of rainwater, which can be


stored for direct use or can be recharged into the groundwater. Water harvesting is the
collection of Runoff for productive purposes. Rain is the first form of water that we know
in the hydrological cycle, hence is a primary source of water for us.

Rivers, lakes and groundwater are all secondary sources of water. In present
times, we depend entirely on such secondary sources of water. In the process, it is
forgotten that rain is the ultimate source that feeds all these secondary sources and remain
ignorant of its value. Water harvesting is to understand the value of rain, and to make
optimum use of rainwater at the place where it falls.

DEPARTMENT OF CSE, EWIT Page 1


RAIN WATER HARVESTING 2016-17

1.1 BENEFITS OF RAINWATER HARVESTING:


1. Environment friendly and easy approach for water requirements
2. RWH is the ideal solution for all water requirements.
3. Increase in ground water level.
4. Mitigates the effects of drought.
5. Reduces the runoff, which otherwise flood storm water drains.
6. Reduces flooding of roads and low-lying areas.
7. Reduced soil erosion.
8. Improves the ground water quality.
9. Low cost and easy to maintain.
10. Reduces water and electricity bills.

1.2 NEED FOR RAINWATER HARVESTING:


1. As water is becoming scarce, it is the need of the day to attain self-sufficiency to
fulfill the water needs.
2. As urban water supply system is under tremendous pressure for supplying water
ever increasing population.
3. Groundwater is getting depleted and polluted.
4. Soil erosion resulting from the unchecked runoff.
5. Health hazards due to consumption of polluted water.

1.3 METHODS OF RAINWATER HARVESTING:


1. Rainwater stored for direct use in above ground or underground sumps /overhead
tanks and used directly for flushing, gardening, washing etc.

2. Recharged to ground through recharge pits, dug wells, bore wells, soak pits,
recharge trenches, etc. (Ground water recharge).

DEPARTMENT OF CSE, EWIT Page 2


RAIN WATER HARVESTING 2016-17

CHAPTER 2:
OPENGL
2.1 INTRODUCTION

Computer graphics is concerned with all aspects of producing pictures or Images


using a computer. The field began humbly almost 50 years ago, with the display of a few
lines on a cathode-ray-tube (CRT). Now we can create images by computer that are
indistinguishable from photographs of real objects. The software used is OpenGL.
Open graphics library is a standard specification defining a 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 and simple
primitives.

OpenGL is widely used in CAD, virtual reality, scientific visualization,


information visualization, flight simulation and video games. OpenGL specifies a set of
commands or immediately executes functions. Each command directs a drawing action or
causes a special effect. A list of these commands can be created by repetitive effects.

OpenGL is independent of windowing characteristics of each operating system.


But provides a special GLU routines for each operating system that enables OpenGL
to work with th system’s windowing environment. OpenGL comes with a large number
of building capabilities. These include hidden surface removal, alpha blending, anti
aliasing, texture mapping, pixel operation, viewing, modeling transformation and
atmospheric effects. Functions in the OpenGL library have names that begin with the
letters gl and are stored in a library usually referred to as GL.

The second is the OpenGL Utility Library (GLU). This library uses only GL
functions but contains code for creating common objects and simplifying viewing.
All functions in GLU can be created from the core GL library. To interface with
the window system and to get input from external devices into our programs, we need at
least one more library. Rather than using a different library for each system, 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.
OpenGL makes use of macros to increase code readability.

DEPARTMENT OF CSE, EWIT Page 3


RAIN WATER HARVESTING 2016-17

OpenGL supports two types of primitives: geometric primitives and raster


primitives. Geometric primitives are specified in the problem domain and include points,
line segments, polygons, curves and surfaces they exist in a 2Dor 2D space, they can be
manipulated by operations such as rotation and translation. Raster primitives, such as
arrays of pixels, lack geometric properties and cannot be manipulated in space.

2.2 GRAPHICS SYSTEMS AND MODELS:

Computer graphics started with the display of data on hardcopy plotters and
cathode ray tube (CRT) 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. Computer graphics today is largely interactive .The user controls
the contents, structure, and appearance of objects and of their displayed images by using
input device, such as a keyboard, mouse, or touch-sensitive panel on the screen. Because
of the close relationship between the input devices and the display, the handling of such
devices is included in the study of computer graphics.

Until the early 1980s, computer graphics was a small, specialized field, largely
because the hardware was expensive and graphics-based application programs that were
easy to use and cost-effective were few. Then, personal computers with built-in raster
graphics display such as the Xerox Star and, later, the mass-produced, even less
expensive Apple Macintosh and the IBM PC and its clones popularized the use of bitmap
graphics for user-computer interaction. A bitmap is a ones and zeros representation of the
rectangular array of points on the screen. The concept of a “desktop” now became a
popular metaphor for organizing screen space. By means of a window manager, the user
could create, position, and resize rectangular screen areas, called windows, that acted as
virtual graphics terminals, each running an application. Almost all interactive application
programs, even those for manipulating text or numerical data, use graphics extensively
in the user interfaces and for visualizing and manipulating the application-specific
objects. Graphics interaction via raster displays has replaced most textual interaction with
alphanumeric terminals. Even people who do not use computers in their daily work
encounter computer graphics in television commercials and as cinematic special effects.

DEPARTMENT OF CSE, EWIT Page 4


RAIN WATER HARVESTING 2016-17

Computer graphics is an integral part of all computer user interfaces, and is


indispensable for visualizing two-dimensional (2D), three-dimensional (3D), and higher-
dimensional objects. Areas as diverse as education, science, engineering, medicine,
commerce, the military, advertising, and entertainment all rely on computer graphics.

2.3 APPLICATIONS OF COMPUTER GRAPHICS:

The development of computer graphics has been driven both by the needs of the
user community and by advances in hardware and software. The applications of computer
graphics are many and varied; we can, however, divide them into four major areas:

 Display of information
 Design
 Simulation and animation
 User interfaces

2.3.1 DISPLAY OF INFORMATION:

Classical graphics techniques arose as a medium to convey information among


people. The human visual system is unrivaled both as a processor of data and as a pattern
recognizer. For centuries, cartographers have developed maps to display celestial and
geographical information.

We have computer plotting packages that provide a variety of plotting techniques


and color tools that can handle multiple large data sets. The field of information
visualization is becoming increasingly more important as we have to deal with
understanding complex phenomena from problems in bioinformatics to detecting security
threats.

Modern imaging technologies such as computed tomography (CT), magnetic


resonance imaging (MRI), ultrasound, and positron-emission tomography (PET)-generate
three dimensional data that must be subjected to algorithmic manipulation to provide
useful information. The field of scientific visualization provides graphical tools that help
these researchers interpret the vast quantity of data that they generate. The system used a
mathematical model to generate the data. The field of information uses computer graphics

DEPARTMENT OF CSE, EWIT Page 5


RAIN WATER HARVESTING 2016-17

to aid in the discovery of relationships in data sets in which there is no physical tie
between u\the data and how they are visualized.

2.3.2 DESIGN:

Professional such as engineering and architecture are concerned with design. Design
is an iterative process. Rarely in the real world is a problem specified such that there is a
unique optimal solution. Design problems are either over determined, such that they
posses no solution that satisfies all the criteria, much less an optimal solution, or
undetermined, such that they have multiple solutions that satisfy the design criteria. Thus,
the designer works iteratively.

The use of interactive graphical tools in computer-aided design (CAD) pervades fields
including as architecture, mechanical engineering, the design of very-large-scale
integrated (VLSI) circuits, and the creation of characters for animations. After the user
produces a possible design, other tools analyze the design and display the analysis
graphically.

2.3.3 SIMULATION AND ANIMATION:

Once graphics systems evolved to be capable of generating sophisticated images in


real time, engineers and researchers began to use them as simulators. One of the most
important uses has been in the training of pilots. Graphical flight simulators have proved
to increase safety and to reduce training expenses. The use of special VLSI chips has led
to a generation of arcade games s as sophisticated as flight simulators.

The success of flight simulators led to the use of computer graphics for animation in
the television, motion picture, and advertising industries. The graphics to drive interactive
video games make heavy use of both standard commodity computers and specialized
hardware boxes. The graphics technology for games, both in the firm of the graphics
processing units that are on graphics cards in personal computers and in game boxes such
as the Xbox and the PlayStation, is being used for simulation rather than expensive
specialized hardware.

DEPARTMENT OF CSE, EWIT Page 6


RAIN WATER HARVESTING 2016-17

2.3.4 USER INTERFACES:

Interaction with computers has become dominated by a visual paradigm that includes
windows, icons, menus, and plotting device, such as mouse. More recently, millions of
people have become Internet users. Their access through graphical network browsers such
as Firefox and Internet Explorer that uses these same interface tools. User interfaces
demonstrate the variety of the tools available in high level modeling packages and the
interactive devices the user can employ in modeling geometric objects.

2.4 THE ADVANTAGES OF 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. “A picture is worth ten thousand words”
became a cliché in our society only after the advent of inexpensive and simple technology
for producing pictures first the printing press, then photography.

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 in 4D, and of data that have no
inherent geometry, such as survey results. Furthermore, we are not confined to static
images although static pictures are good means of communicating information,
dynamically varying pictures are frequently even better – to coin phrase, a moving picture
is worth ten thousand static ones. The use of dynamics is especially effective when the
user can control the animation by adjusting the speed, the portion of the total scene in
view, the amount of detail shown, and the geometric relationship of the objects in the
scene to one another.

With motion dynamics, objects can be moved and tumbled with respect to a stationary
observer. The objects can also remain stationary and the viewer can movedaround them,
pan to select the portion in view, A typically example is the flight simulator.Update
dynamics is the actual change of the shape, color, or other properties of the objects being
viewed. For instance, a system can display the deformations of an airplane structure in
flight. Interactive computer graphics thus permits extensive, high-bandwidth user-
computer interaction.The common use of graphics is to create 2D and 3D graphs of

DEPARTMENT OF CSE, EWIT Page 7


RAIN WATER HARVESTING 2016-17

mathematical, physical and economic functions histograms, bar and pie charts, task
scheduling charts. All of these are used to present meaningfully and concisely the trends
and patterns gleaned from data, so as to clarify complex phenomena and to facilitate
informed decision making.

Computer graphics is used to produce pictures that express a message and attract
attention. Computer graphics is used to produce both accurate and schematic
representations of geographically and other natural phenomena from measurement data,
examples include geographic maps, relief maps.

2.5 GRAPHICS FUNCTIONS:

Function cells output

Application Graphics IO devices


programs system

Data input

Fig 2.5.1:Graphics system as a block box.

Our basic model of a graphics package is a black box, a term that engineers use to denote
a system whose properties are described only by its inputs and outputs. We describe an
API through the functions in its library. Some of the functions are:

 The primitive functions define the low-level objects or atomic entities that our
system can display.
 Attribute functions allow us to perform operations ranging from choosing the
color with which we display a line segment, to picking a pattern with which to fill
the inside of a polygon, to selecting a typeface for the titles of a graph.
 Transformation function allows carrying out transformations of objects, such as
rotation, translation, and scaling. A set of input functions allow us to deal with the
diverse forms of input that characterize modern graphics systems. The control
functions enable us to communicate with the window systems, to initialize our
programs, and to deal with any errors that take place during the execution of
programs. A good API provides much information through a set of functions
known as query functions.

DEPARTMENT OF CSE, EWIT Page 8


RAIN WATER HARVESTING 2016-17

2.5.1 PRIMITIVES:

OpenGL takes an intermediate position. The basic library has a small set of primitives.
The GLU library contains a richer set of objects derived from the basic library. OpenGL
supports two classes of primitives: geometric primitives and image or raster, primitives.
Geometric primitives are specified in the problem domain and include points, line
segments, polygons, curves, and surfaces. Geometric primitives exist in two- or three-
dimensional space and hence can be manipulated by operation such as rotation or
translation.

The primitive and their type specification include the following:

 Points (GL_POINTS): Each vertex is displayed at a size of at least one pixel.


 Line segments (GL_LINES): The line segment type causes successive pairs of
vertices to be interpreted as endpoints of individual segments. Note that
successive segments usually are disconnected because the vertices are processed
on a pair wise basis.
 Polylines (GL_LINE_STRIP, GL_LINE_LOOP) If successive vertices are to be
connected, we can use the line strip, or polyline form. Many curves can be
approximated via suitable polyline. If we wish the polyline to be closed, we can
locate the final vertex in the same place as the first, or we can use the
GL_LINE_LOOP type, which will draw a line segment from the final vertex to
the first, thus creating a closed path.

2.5.2 POLYGON TYPES:

We can specify the following polygon types in OpenGL:

Fig 2.5.2:Convex objects

DEPARTMENT OF CSE, EWIT Page 9


RAIN WATER HARVESTING 2016-17

 Polygons (GL_POLYGON): Successive vertices define line segments, and a line


segment connects that final vertex to the first. The interior is filled according to
the state of the relevant attributes. In OpenGL, we can use the function
glPolygonMode to tell the renderer to generate only the edges or just points for
the vertices, instead of fill.
 Triangles and Quadrilaterals (GL_TRIANGLES,GL_QUADS): These objects are
special cases op polygons. Successive groups of three and four vertices are
interpreted as triangles and quadrilaterals, respectively. Strips and Fans
(GL_TRIANGLE_STRIP, GL_QUAD_STRIP and GL_TRIANGLE_FAN):
These objects are based on groups of triangles or quadrilaterals that share vertices
and edges. In triangle strip, additional vertex is combined with the previous two
vertices to define a new triangle. For the quad strip, we combine two new vertices
to define a new quadrilateral. A triangle fan is based on one fixed point. The next
two points determine the first triangle, and subsequent triangles are formed from
one new point, the previous point, and the first (fixed) point.

GL_TRIANGLE_STRIP GL_QUAD_STRIP GL_TRIANGLE_FAN

Fig 2.5.3: Triangle strip, quadrilateral strip, and triangle fan.

2.6 ABOUT THIS PACKAGE:

This package was developed by interactive computer graphic application using the
OpenGL Application Programming Interface (API). In addition to presenting the calls to
the OpenGL library in the context of generating particular graphics effects, like lighting
and rotation, the package also makes extensive use of programs that allow interactively
manipulating the parameters of the function calls and immediately seeing the effects on
the rendered image.

DEPARTMENT OF CSE, EWIT Page 10


RAIN WATER HARVESTING 2016-17

CHAPTER 3:
SYSTEM REQUIREMENTS

3.1 HARDWARE REQUIREMENTS

Processor : 2.0GHz & above processor

RAM : 2GB and above recommended

Hard disk : 40GB and above

Display : 800 x 600 or higher resolution display with 256 colors

3.2 SOFTWARE REQUIREMENTS

 Operating system : Ubantu 14.04 LTS.


 Compiler Used: Visual studio 2008 C/C++.
 OpenGL API and Library Functions

DEPARTMENT OF CSE, EWIT Page 11


RAIN WATER HARVESTING 2016-17

CHAPTER 4:

DESIGN

4.1 HIGH LEVEL DESIGN SPECIFICATION OF THE PROJECT

4.1.1 BLOCK DIAGRAM

This section describer the design phase involved in the projection.

INSTRUCTIONS

USER INTERFACE

DISPLAY

MOUSE INTERACTION LEFT MOUSE BUTTON CLICK

KEYBOARD INTERACTION WINDOW DISPLAY1

EVENT ACTION

FINISH

Fig 4.1: Block diagram of rain water harvesting

DEPARTMENT OF CSE, EWIT Page 12


RAIN WATER HARVESTING 2016-17

4.1.2 DATA FLOW DIAGRAM

USER

input

MOUSE
INTERFACE

input

KEYBOARD
INTERACTION

EXECUTE
OPERATION

output

EXIT

Fig 4.2 :Design of the rain water harvesting

DEPARTMENT OF CSE, EWIT Page 13


RAIN WATER HARVESTING 2016-17

4.1.3 FLOW CHART

START

Main();

myinit();

Display();

If
key=q

If
key=s

Stop
If
key=
Drawhouse();
r

PostRedisplay();
Rain();

IdleFunction();

STOP

Fig 4.3: Depicts in the stages of design of rain water harvesting

DEPARTMENT OF CSE, EWIT Page 14


RAIN WATER HARVESTING 2016-17

CHAPTER 5:
IMPLEMENTATION
PSUEDO CODE:
The Rain water harvesting project is implemented using following functions.

Void drawhouse ()

Drawing house using the vertices which are initialized above and using the
glPloygon function.

Initialize the color to red.

A wall will be constructed

A door will be constructed

Remaining walls will be constructed

And the top roofs will be constructed

Roof walls will be constructed

A simple coding for this operation is

glBegin(GL_POLYGON);

glVertex2f(house[0][0],house[1][0]);

glVertex2f(house[0][1],house[1][1]);

glVertex2f(house[0][2],house[1][2]);

glVertex2f(house[0][3],house[1][3]);

glEnd();

//Function used to draw the pump which pumps the water.

Void drawpump()

Drawing the two containers for purification purpose

Color is set to red

DEPARTMENT OF CSE, EWIT Page 15


RAIN WATER HARVESTING 2016-17

The supporting tank is constructed for the tank

The pump will be constructed to lift the underground water to main tank

glColor3f(.25,0.0,0.0);

glBegin(GL_POLYGON);

glVertex2f(pump[0][0],pump[1][0]);

glVertex2f(pump[0][1],pump[1][1]);

glVertex2f(pump[0][2],pump[1][2]);

glVertex2f(pump[0][3],pump[1][3]);

glEnd();

Function used to display the character on to the screen.

We are displaying the characters about the pump and chlorine in order to
understand by others by looping statements

glRasterPos2i(-350,-150);

glutBitmapCharacter(GLUT_BITMAP_HELVETICA_12,'C');

//Function used to draw line.

Void line ()

This will constructs the line to represent the pump with a arrow mark and simple
coding is shown for this below

glColor3f(1.0,0.0,0.0);

glBegin(GL_LINES);

glVertex2f(-440,-180);

glVertex2f(-360,-155);

glVertex2f(-280,-310);

glVertex2f(-200,-210);

glEnd();

DEPARTMENT OF CSE, EWIT Page 16


RAIN WATER HARVESTING 2016-17

//Function used to display charcoal which is in the form of circle.

Void circle_draw(GLint h,GLint k,GLint r)

Using the circle functions we are displaying the charcoal and positioned these
charcoals inside the purifier tank

//Function used to display Rain

Void rain1()

This function is invoked when the button r/R is pressed

The rain is created by using glPoints and these point is set to blue to create rain
effect and these rains will be collected on the roof of the house.

For (int k=24;k>=0;k--)

If (rainpoint1[k][1]==-60.0)

rainpoint1[k][1]=400.0;

for(int l=1;l<=24;l++)

glBegin(GL_POINTS);

glColor3f(0.0,0.5,1.0);

glVertex2fv(rainpoint1[l]);

glEnd();

DEPARTMENT OF CSE, EWIT Page 17


RAIN WATER HARVESTING 2016-17

Once the one flow of rain water is executed it will call the second rain function
until 35lines of rain

for(i=23;i>=0;i--){rainpoint1[i][1]=rainpoint1[i][1]-2;}rain2();

//Function which is used to show the flow of the water

Void flow1()

This function is used to control the flow of rain water. The rain which has been
collected on the top of house will be first sent to purifier. Using the remaining
flow functions procedure will follows. The water is sent to ground tank. The
ground water will fill up to some level, then flow of this water will be
automatically pumped to main tank. This is the basic function of this function.

glPointSize(4.0);

for(int k=1;k>=0;k--)

if(waterpoint[k][0]==-527.0)

waterpoint[k][0]=-535.0;

for(i=1;i>=0;i--)

waterpoint[i][0]=waterpoint[i][0]+0.5;

for(int l=1;l>=0;l--)

glBegin(GL_POINTS);

glColor3f(0.0,0.25,1.0);

DEPARTMENT OF CSE, EWIT Page 18


RAIN WATER HARVESTING 2016-17

glVertex2fv(waterpoint[l]);

glEnd();

//Function which is used to take input from the keyboard.

void mykey(unsigned char key,int x,int y)

//The function is used to color the object which is drawn after this function is called. The
R, G and B are used to specify the color combinations.

glColor3f(R, G ,B);

//Function is used to specify the background color of window. Here O/T option or field is
used to specify the opaqueness or transparency.

glClearColor(R, G, B, O/T);

//Function is used to initializes the window size. Here the x and y in the function specify
the size of the window.

glutInitWindowSize(x,y);

//Function to initialize the position of the window. Here the x and y in the function
specify the position of the window on the display screen.

glutInitWindowPosition(x,y);

//Function to create the window. Here the name of the window is passed as the argument.

glutCreateWindow(window name);

DEPARTMENT OF CSE, EWIT Page 19


RAIN WATER HARVESTING 2016-17

5.1: SOURCE CODE


#include<stdio.h>
#include<math.h>
#include<GL/glut.h>
#include<string.h>
#include<stdlib.h>
#define radian 3.14159/180.0
static GLfloat spin=0.0;
float theta=0.0;
GLfloat x,y;
GLint i;
float fla=0;
void flow2();
void disprectangle();
void rain1();
void circle_draw(GLint,GLint,GLint);
typedef float points[2];
GLfloat count=0;
GLfloat count1=0;
void flow1()
{ glPointSize(4.0);
for(int k=1;k>=0;k--)
{ if(waterpoint[k][0]==-527.0)
{
waterpoint[k][0]=-535.0;
}
}
for(i=1;i>=0;i--)
{

DEPARTMENT OF CSE, EWIT Page 20


RAIN WATER HARVESTING 2016-17

waterpoint[i][0]=waterpoint[i][0]+0.5;
}
for(int l=1;l>=0;l--)
{
glBegin(GL_POINTS);
glColor3f(0.0,0.25,1.0);
glVertex2fv(waterpoint[l]);
glEnd();
}
}

void flow2()
{ glPointSize(4.0);
for(int k=35;k>=0;k--)
{ if(waterpoint2[k][1]==-170.0)
{
waterpoint2[k][1]=175.0;
}
}
for(i=35;i>=0;i--)
{
waterpoint2[i][1]=waterpoint2[i][1]-0.5;
}
for(int l=0;l<=35;l++)
{ glBegin(GL_POINTS);
glColor3f(0.0,0.25,1.0);
glVertex2fv(waterpoint[l]);
glEnd();
}

DEPARTMENT OF CSE, EWIT Page 21


RAIN WATER HARVESTING 2016-17

void disprectangle1()
{
glColor3f(0.0,0.25,1.0);
glBegin(GL_POLYGON);
glVertex2f(-400.0,185.0);
glVertex2f(-350.0,185.0);
glVertex2f(-350.0,200.0);
glVertex2f(-400.0,200.0);
glEnd();
glBegin(GL_POLYGON);
lVertex2f(-350.0,200.0);
glVertex2f(-350.0,240.0);
glVertex2f(-365.0,240.0);
glVertex2f(-365.0,200.0);
glEnd();
glBegin(GL_POLYGON);
for(int l=0;l<=3;l++)
{
glVertex2fv(rectangle1[l]);
}
glEnd();
if(count>1730 && count<4500)
{
rectangle1[2][1]=rectangle1[2][1]+0.04;
rectangle1[3][1]=rectangle1[3][1]+0.04;
}
}

DEPARTMENT OF CSE, EWIT Page 22


RAIN WATER HARVESTING 2016-17

Void rain1()
{ glPointSize(4.0);
for(int k=24;k>=0;k--)
{
if(rainpoint1[k][1]==-60.0)
{
rainpoint1[k][1]=400.0;
}
}
for(int l=1;l<=24;l++)
{ glBegin(GL_POINTS);
glColor3f(0.0,0.5,1.0);
glVertex2fv(rainpoint1[l]);
glEnd();
}
for(i=23;i>=0;i--)
{
rainpoint1[i][1]=rainpoint1[i][1]-2;
}
rain2();
}

void drawhouse()
{ count1=count1+1;
glColor3f(0.5,0.0,0.0);
glBegin(GL_POLYGON);
glVertex2f(house[0][0],house[1][0]);
glVertex2f(house[0][1],house[1][1]);

DEPARTMENT OF CSE, EWIT Page 23


RAIN WATER HARVESTING 2016-17

glVertex2f(house[0][2],house[1][2]);
glVertex2f(house[0][3],house[1][3]);
glEnd();

glColor3f(1.0,1.0,0.0);
glBegin(GL_POLYGON);
glVertex2f(house[0][7],house[1][7]);
glVertex2f(house[0][8],house[1][8]);
glVertex2f(house[0][9],house[1][9]);
glVertex2f(house[0][10],house[1][10]);
glEnd();

glColor3f(0.0,0.5,0.0);
glBegin(GL_POLYGON);
glVertex2f(house[0][1],house[1][1]);
glVertex2f(house[0][4],house[1][4]);
glVertex2f(house[0][5],house[1][5]);
glVertex2f(house[0][2],house[1][2]);
glEnd();

glColor3f(0.5,0.0,0.0);
glBegin(GL_POLYGON);
glVertex2f(house[0][2],house[1][2]);
glVertex2f(house[0][5],house[1][5]);
glVertex2f(house[0][6],house[1][6]);
glVertex2f(house[0][3],house[1][3]);
glEnd();

glColor3f(1.0,1.0,1.0);

DEPARTMENT OF CSE, EWIT Page 24


RAIN WATER HARVESTING 2016-17

glBegin(GL_POLYGON);
glVertex2f(house[0][1],house[1][1]);
glVertex2f(house[0][11],house[1][11]);
glVertex2f(house[0][14],house[1][14]);
glVertex2f(house[0][2],house[1][2]);
glEnd();

glBegin(GL_POLYGON);
glVertex2f(house[0][1],house[1][1]);
glVertex2f(house[0][11],house[1][11]);
glVertex2f(house[0][12],house[1][12]);
glVertex2f(house[0][4],house[1][4]);
glEnd();

glBegin(GL_POLYGON);
glVertex2f(house[0][12],house[1][12]);
glVertex2f(house[0][13],house[1][13]);
glVertex2f(house[0][5],house[1][5]);
glVertex2f(house[0][4],house[1][4]);
glEnd();

glBegin(GL_POLYGON);
glVertex2f(house[0][14],house[1][14]);
glVertex2f(house[0][13],house[1][13]);
glVertex2f(house[0][5],house[1][5]);
glVertex2f(house[0][2],house[1][2]);
glEnd();
if(count1>30)
drawconts();

DEPARTMENT OF CSE, EWIT Page 25


RAIN WATER HARVESTING 2016-17

}
void main(int argc,char **argv)
{
glutInit(&argc,argv);
glutInitDisplayMode(GLUT_DOUBLE|GLUT_DEPTH|GLUT_RGB);
glutInitWindowPosition(0,0);
glutInitWindowSize(1050,1050);
glutCreateWindow("RAIN WATER HARVESTING");
myinit();
glutDisplayFunc(display);
glutFullScreen();
glutCreateMenu(mymenu);
glutAddMenuEntry("SCREEN",1);
glutAddMenuEntry("EXIT",2);
glutAttachMenu(GLUT_RIGHT_BUTTON);
glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
glutIdleFunc(idle);
glutKeyboardFunc(mykey);
glutMainLoop();
}

DEPARTMENT OF CSE, EWIT Page 26


RAIN WATER HARVESTING 2016-17

CHAPTER 6:
SNAPSHOTS AND RESULT DISCUSSION
 This is the initial setup of the page which shows our college name, guide name
and our names

Fig 6.1:Initial sheet.

 This is the initial setup of the house ,purifier and tank when the s/S button is
pressed

Fig 6.2:Setup of house and tank

DEPARTMENT OF CSE, EWIT Page 27


RAIN WATER HARVESTING 2016-17

 This is when the r/R is pressed. When this button is pressed it rains and collected
on the roof of the house

Fig 6.3:Setup while raining

 The collecting of the water in the purifier and in the ground tank and
automatically the water is pumped up.

Fig 6.4:Setup while tank is filling

DEPARTMENT OF CSE, EWIT Page 28


RAIN WATER HARVESTING 2016-17

 When the tank water is filled, the pump will automatically stop and this is the
process of rain water harvesting.

Fig 6.5: Setup after tank is filled

DEPARTMENT OF CSE, EWIT Page 29


RAIN WATER HARVESTING 2016-17

CONCLUSION

An attempt has been made to develop an OpenGL package which meets necessary
requirements of the user successfully.Since it is user friendly it enables the user to interact
efficiently and easily.The development of mini project has given as a good exposure to
OpenGL by which we have learnt some of the techniques which help in the development
of animation picture and gaming.Hence it is helpful for us even to take this field as our
career too and develop some other features in OpenGL and provide as token of
contribution to the graphics world.

DEPARTMENT OF CSE, EWIT Page 30


RAIN WATER HARVESTING 2016-17

REFERENCES

 Coombes PJ(2007).Energy and economic impact of rain water tanks on the


operation of regional system.
 OpenGL Programming Guide (Addison-Wesley Publishing Company).
 The OpenGL Utility Toolkit (GLUT)Programming Interface .
 -API Version 3 BY MARK J. KILGARD.
 Interactive computer graphics.
 -A top down approach by using Open GL by EDWARD ANGEL.

DEPARTMENT OF CSE, EWIT Page 31


RAIN WATER HARVESTING 2016-17

APPENDIX

SL
FUNCTION DESCRIPTION
NO.

sets the current window to


1 void glutSetWindow(int id)
thewindow with identifier id.

void glutContextVersion(intmajor_version,
2 sets the desired context.
intminor_version)

sets the desired context to either


GLUT_CORE_PROFILE or
3 void glutContextProfile(init profile)
GLUT_COMPATIBILITY_
PROFILE.

void glGenVertexArrays(GLsizei n, GLuint Generatesan unused identifiers for


4
*array) vertex array objects in array.

void glGenBuffers(GLsizei n, GLuint Generatesan unused identifiers for


5
*buffer) buffer objects in buffer.

void glBufferSubData(GLenum target, updates size bytes starting at offset in


6 Glintiptr offset, GLsizeiptrsize,constGLvoid the current buffer object with data
*data) of typetarget starting at data.

void glEnableVertexAttribArray(GLuint enables the vertex array with


7
index) identifier index.

registers the display callback


function f that is executedwhenever
8 void glutIdleFunc(void (*f)(void))
there are no otherevents to be
handled.

DEPARTMENT OF CSE, EWIT Page 32


RAIN WATER HARVESTING 2016-17

registers the motion callback


function f. The position of mouse is
9 void glutMotionFunc(void (*f)(int x, int y)) returned by thecallback when the
mouse is moved at with least one of
the mouse buttons pressed.

registers the motion callback


void glutPassiveMotionFunc(void (*f)(int x, function f. The position of the
10
int y)) mouse is returned by thecallback
when the mouse is moved.

sets the desired mode for polygon


rendering the faces
void glPolygonMode(glEnum faces, (GL_FRONT_AND_BACK).
11
glEnum mode) Mode can be
GL_POINTS,GL_LINES, or
GL_FILL.

sets the point size attribute in


12 void glPointSize(GLfloat size)
pixels.

sets flag to make the depth


13 glDepthMask(GLboolean flag) buffer read-only (GL_FALSE)
or writable (GL_TRUE).

glTexParameter[if](GLenum target, sets the texture parameterparam to


14
GLenumparam, TYPE value) value for texture of type target.

returns in name the first integer


glGenTextures(GLsizei n, GLuint name)
15 of n unused integer for texture-
object identifiers.

deletes n texture objects from the


glDeleteTextures(GLsizei n, GLuint
16 array namearraythat holds
*namearray)
texture-object names.

DEPARTMENT OF CSE, EWIT Page 33


RAIN WATER HARVESTING 2016-17

selects the color-buffer bufferfor


17 void glDrawBuffer(GLenum buffer)
rendering.

selects one of the 16 logical writing


modes if the feature
GL_COLOR_LOGIC_OP is enabled.
18 void glLogicOp(GLenum op)
Modes include replacement
(GL_COPY), the default, and
exclusive or (GL_XOR).

void glGetBooleanv(GLenum name, writes the present value of the


19
GLboolean *param) parameter name into param.

creates an empty program object


20 GLuintglCreateProgram()
and returns an identifier for it.

returns the current value of a GLUT


state variable such as
21 intglutGet(GLenum state)
GLUT_WINDOW_WIDTH,GLUT_
WINDOW_HEIGHT.

creates an empty shaderobject of type


GL_VERTEX_SHADER or
22 GLuintglCreateShader(GLenum type)
GL_FRAGMENT_SHADER and
returns an identifier for it.

23 void glCompileShader(GLuintshader) Compilesshaderobjectshader.

identifies the source code forshaderas


coming from an array of nstrings
void glShaderSource(GLuintshader,
strings of lengths characters. If the
24 GLsizeinstrings, constGLchar**strings,
shader is a single-null terminated
const Glint*lengths)
string,then nstrings is 1 and lengths is
NULL.

DEPARTMENT OF CSE, EWIT Page 34


RAIN WATER HARVESTING 2016-17

void glAttachShader(GLunit program, Attachesshader object shader to


25
GLuintshader) program object program.

links together the application


26 void glLinkProgram(GLuint program) and shaders in program object
program.

void glUseProgram(GLuint program) makes program the active program


27
object.

returns in paramthe value of


void glGetProgram(GLuint program,
28 parameter
GLenumpname, GLinit *param)
pnameforprogramobjectprogram.

returns in
void glGetShaderiv(GLuintshader,
29 paramthevalueofparameterpnamefors
GLenumpname, GLint *param)
haderobjectshader.

returns the info log string for


void getProgramInfoLog(GLuint program,
program object program into the
30 GLsizeimaxL, GLsizei *len,GLchar
array info of lenthmaxLand the
*infoLog)
length of the string in len.

void getShaderInfoLog(GLuint program, returns the info log string for shader
31 GLsizeimaxL, GLsizei *len,GLchar object program into the array info of
*infoLog) lenthmaxL.

renders the character with ASCII


code char at the current raster
void glutStrokeCharacter(void* font, int
position using the strokefont given by
32 char)
fontGLUT_STROKE_MONO and
GLUT_STROKE_ROMAN.

void glutWireTeapot(GLdouble size) generates a Utah teaport including


normals and texture coordinates of
33 void glutSolidTeapot(GLdouble size.

DEPARTMENT OF CSE, EWIT Page 35


RAIN WATER HARVESTING 2016-17

starts a new display list with


identifier name. The value of mode
void glNewList(GLuint name, Glenum
determines if the list is placed on the
34 mode)
server with or without executing the
list.GL_COMPILE_AND_EXEUTE.

ends the specification of a display


void glEndList()
35 list.

sets the render mode to


36 void glRenderMode(Glenum mode) mode(GL_RENDER,GL_SELECTION
GL_FEEDBACK).

specifies the array buff of n integers


37 void glSelectBuffer(Glsizei n, Gluint *buff)
to place selection data.

creates a projection matrix for


void gluPickMatrix(GLdouble x, GLdouble picking that restricts rendering to a w
38
y, GLdouble w, GLdouble h, GLint *vp) X h area centered at (x,y) inwindow
coordinates within the viewport vp.

void glGenVertexArrays(GLsizei n, GLuint Generatesan unused identifiers for


39
*array) vertex array objects in array.

void glMapGrid1fd(Glint n, TYPE u0,


sets up an equally space grid of n
TYPE u1)void glMapGrid2fd(Glint n,
40 partitions between u0 and u1 (and of
TYPE u0, TYPE u1, Glint m, TYPE v0,
m partitions between v0 & v1).
TYPE v1)

defines quadric object obj as a sphere


void gluSphere(GLUquadricObj *obj,
of radius using slices lines of
41 GLdouble radius, GLint slices, GLint
longitude and stacks lines of
stacks)
lattitude.

gluBuild2Dmipmaps(GLenum target,
GLintiformaGLint width, GLint height,
42 builds and loads a set of mipmaps.
GLenum format, GLenum type, void

DEPARTMENT OF CSE, EWIT Page 36


RAIN WATER HARVESTING 2016-17

*texels)

binds name to texture of type target


(GL_TEXTURE_1D,
glBindTextures(Glenum target, Gluint
43
name) GL_TEXTURE_2D,

GL_TEXTURE_3D).

requests that hint to be applied to


44 glHint(Glenum option, Glenum hint)
option.

45 void glDisableClientState(Glenum array) disables one of the array.

defines the operation (GL_ACCUM,


GL_LOAD,

46 glAccum(Glenum operation, Glfloat value) GL_RETURN, GL_ADD) performed


by the accumulation

buffer using the constant value.

sets fog parameter param to value.


47 Parameters include
void glFog[if](Glenumparam, TYPE value)
GL_FOG_MODE,GL_FOG_COLO
R,GL_FOG_DENSITY.

draws elements of the standard


OpenGL types mode, such as
void glDrawElements(Glenum mode, GL_POLYGON or GL_LINES,
48 Glsizei n, Glenum type, void *indices) using n indecies from the array
indices of type
GL_UNSIGNED_BYTE,
GL_UNSIGNED_SHORT

DEPARTMENT OF CSE, EWIT Page 37


RAIN WATER HARVESTING 2016-17

void glVertexPointer(Glint dim, Glenum


type, Glsizei stride, Glvoid *array)

void glColorPointer(Glint dim, Glenum specifies data for arrays. The data are

type, Glsizei stride, Glvoid *array) in array of type with dimension dim,
49 stride is the number of bytes between
void glNormalPointer(Glint dim, Glenum consecutive data values (0 indicates
type, Glsizei stride, Glvoid *array) the data are packed in array).

void glTextCoordPointer(Glint dim,


Glenum type, Glsizei stride, Glvoid *array)

returns the index of uniform variable


Glint glGetUniformLocation(GLuint
50 name from the linked program object
program, constGlchar *name)
program.

DEPARTMENT OF CSE, EWIT Page 38

You might also like