Professional Documents
Culture Documents
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.
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.
2. Recharged to ground through recharge pits, dug wells, bore wells, soak pits,
recharge trenches, etc. (Ground water recharge).
CHAPTER 2:
OPENGL
2.1 INTRODUCTION
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.
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.
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
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.
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.
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.
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
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.
Data input
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.
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.
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.
CHAPTER 3:
SYSTEM REQUIREMENTS
CHAPTER 4:
DESIGN
INSTRUCTIONS
USER INTERFACE
DISPLAY
EVENT ACTION
FINISH
USER
input
MOUSE
INTERFACE
input
KEYBOARD
INTERACTION
EXECUTE
OPERATION
output
EXIT
START
Main();
myinit();
Display();
If
key=q
If
key=s
Stop
If
key=
Drawhouse();
r
PostRedisplay();
Rain();
IdleFunction();
STOP
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.
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();
Void drawpump()
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();
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');
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();
Using the circle functions we are displaying the charcoal and positioned these
charcoals inside the purifier tank
Void rain1()
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.
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();
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();
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);
glVertex2fv(waterpoint[l]);
glEnd();
//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);
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();
}
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;
}
}
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]);
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);
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();
}
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();
}
CHAPTER 6:
SNAPSHOTS AND RESULT DISCUSSION
This is the initial setup of the page which shows our college name, guide name
and our names
This is the initial setup of the house ,purifier and tank when the s/S button is
pressed
This is when the r/R is pressed. When this button is pressed it rains and collected
on the roof of the house
The collecting of the water in the purifier and in the ground tank and
automatically the water is pumped up.
When the tank water is filled, the pump will automatically stop and this is the
process of rain water harvesting.
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.
REFERENCES
APPENDIX
SL
FUNCTION DESCRIPTION
NO.
void glutContextVersion(intmajor_version,
2 sets the desired context.
intminor_version)
returns in
void glGetShaderiv(GLuintshader,
29 paramthevalueofparameterpnamefors
GLenumpname, GLint *param)
haderobjectshader.
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.
gluBuild2Dmipmaps(GLenum target,
GLintiformaGLint width, GLint height,
42 builds and loads a set of mipmaps.
GLenum format, GLenum type, void
*texels)
GL_TEXTURE_3D).
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).