1.1 Computer Graphics: Water Cycle
1.1 Computer Graphics: Water Cycle
1.1 Computer Graphics: Water Cycle
CHAPTER 1
INTRODUCTION
1.2 OpenGL
Display Lists:
All data, whether it describes geometry or pixels, can be saved in a display list for
current or later use. When a display list is executed, the retained data is sent from the
display list just as if it were sent by the application in immediate mode.
➢ Pixel Operation: While geometric data takes one path through the
OpenGL rendering pipeline, pixel data takes a different route. Pixels from an array in
system memory are first unpacked from one of a variety of formats into the proper
number of components. Next the data is scaled, biased, and processed by a pixel map.
The results are clamped and then either written into texture memory or sent to the
rasterization step.
1.4 Scope
It is developed in Visual Studio 2022. It has been implemented on
WINDOWS platform. The 3-D graphics package designed here provides an
interface for the users for handling the display and manipulation of Celestial
Exploratory. The Keyboard is the main input device used.
LITERATURE SURVEY
WATER CYCLE:
The land – atmosphere interaction through exchanges of energy, water, momentum
between the land surface and atmosphere is well understood. The land surface
characteristics such as the Albio, roughness, and land cover/land use can have an
impact on the water cycle. However, in the water cycle, the role of aerosols is not
taken into account. Aerosols play an important role in many areas including human
health, atmospheric reactions, the radiation and precipitation.
Increases in aerosol concentration and changes in their composition may
affect the Earth’s climate and water supply. Aerosols have direct and indirect effects
on the Earth’s climate system by reducing the amount of solar radiation that reaches
the surface and changing the properties of clouds. On the one hand, as aerosols
increase, the surface temperature may cool due to its direct effect.
On the other hand, owing to the indirect effect, as aerosols concentration
increases, it may decrease the rainfall through increasing the small CCN which can
reduce the collision rate. In this way, changing aerosols in the atmosphere can
change the frequency of cloud occurrence, cloud thickness, and rainfall amounts.
In some sense, the increase of aerosols can change the frequency of heavy
rainfall. Likewise, in the hydrologic cycle, the land surface features especially the
soil moisture and vegetation variation can affect the aerosols formation through
changing the secondary organic aerosols.
Conceptually, these potential feedbacks are well known; however, the
processes controlling each step in this coupled system are highly uncertain. The
importance of these processes to the hydrologic cycle is unknown.
Much work has been done to understand the formation of anthropogenic
aerosols including the measurements, the laboratory experiments and model
simulations. While progress has been made in understanding the direct input for
aerosols, the contribution of secondary organic aerosols is also very important for
understanding the aerosols and hydrologic cycle.
Page 5
First, a large parent organic is oxidized to produce products with vapor
pressures significantly lower than that of the parent. These products can partition
between the gas and aerosol phases via condensation and nucleation (Griffin et al.,
2002). The secondary aerosols are formed by the reaction of volatile organic
compounds with the principle atmospheric oxidizing agents (i.e., ozone, no3
radicals).
So, the volatile organic compounds (VOCs) including anthropogenic and
biogenic types are important for the formation of secondary organic aerosols.
Greenberg et al. (1999) found over 90% of the total VOCs entering the atmosphere
are biogenic. Biogenic VOCs (BVOCs) from the vegetation can regulate the
atmosphere trace gas composition, in which, isoprene is the primary VOC emitted
from trees in different locations.
The total flux of biogenic nonmethane volatile organic compounds
(NMVOCs) in North America is comprised primarily of isoprene (35%) (Guenther
et al., 2000). And there are 98% of the total annual natural NMVOCs emissions are
emitted by vegetation. The emission inventories are very important in determining
the flux of BVOCs. Not only different vegetations can emit different fractions of
BVOCs, but also the same vegetation in different locations can emit different
fractions of BVOCs due to different climate conditions and soil types.
The aerosols from the oxidization of BVOCs have been investigated showing
their importance for the formation of secondary organic aerosols (Koch et al., 2000).
But estimates of the biogenic aerosols from the oxidization of BVOCs are not well
understood due to the large potential sources and complex processes. Understanding
the secondary organic aerosols is one of most important questions to understand
water cycle in the atmosphere and land surface.
The feedback mechanism between the anthropogenic and secondary organic
aerosols and hydrologic cycle is an important issue for climate prediction and air
forecasting.
Page 6
CHAPTER 3
REQUIREMENTS SPECIFICATIONS
Language: C/C++
Tool: CODE BLOCKS 17.12
Library: OpenGL
Page 7
CHAPTER 4
SYSTEM DESIGN
Page 8
3. #include<math.h>: This is a C library function for performing certain
mathematical operations.
In the Init () we have made use of the following functions:
1. glClearColor (. . .): Whenever we wish to draw a new frame, the window
must be cleared by using the 4-dimensional (RGBA)color system. The above
function must be enabled to make the window on screen solid and white.
2. glshadeModel (. . .): To enable the smooth shading we must set the shade
as follows
glShadeModel (GL_SMOOTH);
3. glEnable(. . .): The Z-buffer is one of the buffers that make up the frame
buffer.The depth buffer must be cleared whenever we wish to redraw the
display.This is done as follows
glEnable(GL_DEPTH_TEST);
4. glMaterial(. . .): We can specify different material properties for the front
and back faces of a surface through the following functions
glMaterialfv(GLenum face, GLenum type,GLfloat *pointer_to_array);
glMaterialfv(GLenum face,GLenum type,GLfloat value);
5. glLight(. . .): This function is used to enable a light source.The following
function specifies the required vector and scalar parameters to enable a light
source.
glLightfv(GLenum source,GLenum parameter,GLfloat*pointer_to_arrary))
glLightf(GLenum source,GLenum parameter,GLfloat value)
6. glColorMaterial(. . .): This function is used to change a single material
property.
myinit();
Here we initialize the color buffer, set the point size and set window co-
ordinate values.
display ();
This function creates and translates all the objects in a specified locatioN in
a particular order.
Page 9
Translated (. . .);
In this function the variables are components of displacement vector.
glutPostRedisplay ();
It ensures that display will be drawn only once each time program goes
through the event loop.
glutMainLoop ();
This function whose execution will cause the program to begin an event
processing loop.
Page 10
WATER CYCLE 2021-2022
CHAPTER 5
IMPLEMENTATION
Step 1: The required texture image must first be converted into a TGA format image
which is used by the tgaload function.
Step 2: The TGA format image is then stored in the desired location and then it is
provided to the program to perform the required operations to display the texture.
5.1 glBegin() :
5.2 glEnd(void) :
5.3 glPushMatrix() :
glPushMatrix pushes the current matrix stack down by one level, duplicating
the current matrix.
Page 11
WATER CYCLE 2021-2022
5.4 glPopMatrix() :
glPopMatrix pops the top matrix off the stack, destroying the contents of the
popped matrix. Initially, each of the stacks contains one matrix, an identity matrix.
5.5 glTranslate() :
5.6 glClear() :
5.7 glClearColor() :
Sets the current clearing color for use in clearing color buffers in RGBA mode. The
red, green, blue, and alpha values are clamped if necessary to the range [0,1]. The
default clearing color is (0, 0, 0, 0), which is black.
Page 12
WATER CYCLE 2021-2022
5.8 glMatrixMode() :
5.9 glutInitWindowPosition() :
This API will request the windows created to have an initial position. The arguments x,
y indicates the location of a corner of the window, relative to the entire display.
5.10 glLoadIdentity() :
void glLoadIdentity(void);
5.11 glutInitWindowSize() :
The API requests windows created to have an initial size. The arguments width and
height indicate the window’s size (in pixels). The initial window size and position are
hints and may be overridden by other requests.
5.12 glutInitDisplayMode():
Specifies the display mode, normally the bitwise OR-ing of GLUT display mode bit
masks. This API specifies a display mode (such as RGBA or color-index, or single or
double-buffered) for windows.
Page 13
WATER CYCLE 2021-2022
5.13 glutSwapBuffers() :
void glutSwapBuffers(void);
Performs a buffer swap on the layer in use for the current window.
Specifically, glutSwapBuffers promotes the contents of the back buffer of the layer in
use of the current window to become the contents of the front buffer. The contents of
the back buffer then become undefined. The update typically takes place during the
vertical retrace of the monitor, rather than immediately after glutSwapBuffers is called.
5.14 glutCreateWindow() :
The parameter name specifies any name for window and is enclosed in double
quotes. This opens a window with the set characteristics like display mode, width,
height, and so on. The string name will appear in the title bar of the window system.
The value returned is a unique integer identifier for the window. This identifier can be
used for controlling and rendering to multiple windows from the same application.
5.15 glutDisplayFunc() :
Specifies the new display callback function. The API specifies the function
that’s called whenever the contents of the window need to be redrawn. All the routines
need to be redraw the scene are put in display callback function.
Page 14
WATER CYCLE 2021-2022
5.16 glVertex3f
5.17 glColor3f
5.18 glGenTextures():
PARAMETERS:
Textures : Specifies an array in which the generated texture names are stored.
glGenTextures returns n texture names in textures. There is no guarantee that the names
form a contiguous set of integers; however, it is guaranteed that none of the returned
names was in use immediately before the call to glGenTextures.
Page 15
WATER CYCLE 2021-2022
5.19 glBindTexture():
PARAMETERS:
target: Specifies the target to which the texture is bound. Must be one
of GL_TEXTURE_1D,
GL_TEXTURE_2D, GL_TEXTURE_3D, GL_TEXTURE_1D_ARRAY, GL_TEXTUR
E_2D_ARRAY,
GL_TEXTURE_RECTANGLE, GL_TEXTURE_CUBE_MAP, GL_TEXTURE_CUBE
_MAP_ARRAY,
GL_TEXTURE_BUFFER, GL_TEXTURE_2D_MULTISAMPLE or GL_TEXTURE_2
D_MULTISAMPLE_ARRAY.
5.20 glutInit():
PARAMETERS:
argcp : A pointer to the program's unmodified argc variable from main. Upon return, the
value pointed to by argcp will be updated, because glutInit extracts any command line
options intended for the GLUT library.
argv : The program's unmodified argv variable from main. Like argcp, the data for argv
will be updated because glutInit extracts any command line options understood by the
GLUT library.
glutInit(&argc,argv);
Page 16
WATER CYCLE 2021-2022
5.22 glLightfv():
PARAMETERS:
Light: The identifier of a light. The number of possible lights depends on the
implementation, but at least eight lights are supported. They are identified by symbolic
names of the form GL_LIGHTi where i is a value: 0 to GL_MAX_LIGHTS - 1.
Pname: A light source parameter for light. The following symbolic names are accepted:
GL_DIFFUSE: The params parameter contains four integer or floating-point values that
specify the diffuse RGBA intensity of the light. Integer values are mapped linearly such
that the most positive represent able value maps to 1.0, and the most negative represent
able value maps to 1.0. Floating-point values are mapped directly. Neither integer nor
floating-point values are clamped. The default diffuse intensity is (0.0, 0.0, 0.0, 1.0) for
all lights other than light zero. The default diffuse intensity of light zero is (1.0, 1.0, 1.0, 1.0).
GL_SPECULAR: The params parameter contains four integer or floating-point values
that specify the specular RGBA intensity of the light. Integer values are mapped linearly
such that the most positive represent able value maps to 1.0, and the most negative
represent able value maps to 1.0. Floating-point values are mapped directly. Neither
integer nor floating-point values are clamped. The default specular intensity is (0.0, 0.0,
0.0, 1.0) for all lights other than light zero. The default specular intensity of light zero is
(1.0, 1.0, 1.0, 1.0).
Page 17
WATER CYCLE 2021-2022
GL_AMBIENT: The params contains four integer or floating-point values that specify
the ambient RA intensity of the light. Integer values are mapped linearly such that the
most positive represent able value maps to 1.0, and the most negative representable value
maps to -1.0 . Floating-point values are mapped directly. Neither integer nor floating-
point values are clamped. The initial ambient light intensity is (0,0, 0, 1).
5.23 glEnable():
Ex: glEnable(GL_CULL_FACE);
PARAMETERS:
5.24 glDisable():
PARAMETERS:
Page 18
WATER CYCLE 2021-2022
5.25 gluNewQuadric():
GLUquadric* gluNewQuadric(void);
Performs a buffer swap on the layer in use for the current window.
Specifically, glutSwapBuffers promotes the contents of the back buffer of the layer in
use of the current window to become the contents of the front buffer. The contents of the
back buffer then become undefined. The update typically takes place during the vertical
retrace of the monitor, rather than immediately after glutSwapBuffers is called.
5.26 gluQuadricNormals():
PARAMETERS:
gluQuadricNormals specifies what kind of normal are desired for quadrics rendered
with quad. The legal values are as follows:
GLU_SMOOTH: One normal is generated for every vertex of a quadric. This is the initial
value.
Page 19
WATER CYCLE 2021-2022
5.27 gluQuadricTexture():
PARAMETERS:
The way texture coordinates are generated depends upon the specific quadric rendered.
5.28 gluLookAt():
PARAMETERS:
gluLookAt creates a viewing matrix derived from an eye point, a reference point
indicating the center of the scene, and an UP vector.
Page 20
WATER CYCLE 2021-2022
5.29 gluSphere():
PARAMETERS:
Slices: Specifies the number of subdivisions around the z axis (similar to lines of
longitude).
Stacks: Specifies the number of subdivisions along the z axis (similar to lines of latitude).
gluSphere draws a sphere of the given radius centered around the origin. The sphere is
subdivided around the z axis into slices and along the z axis into stacks (similar to lines of
longitude and latitude).
5.30 glViewport():
PARAMETERS:
x,y : Specify the lower left corner of the viewport rectangle, in pixels. The initial
value is (0,0).
width, height : Specify the width and height of the viewport. When a GL context is first
attached to a window, width and height are set to the dimensions of that window.
Page 21
WATER CYCLE 2021-2022
5.31 glFrustum():
PARAMETERS:
left, right: Specify the coordinates for the left and right vertical clipping planes.
bottom, top: Specify the coordinates for the bottom and top horizontal clipping planes.
nearVal, farVal: Specify the distances to the near and far depth clipping planes. Both
distances must be positive. glFrustum describes a perspective matrix that produces a
perspective projection.
5.32 glutTimerFunc():
The number of milliseconds is a lower bound on the time before the callback is generated.
GLUT attempts to deliver the timer callback as soon as possible after the expiration of the
callback's time interval.
There is no support for canceling a registered callback. Instead, ignore a callback based
on its value parameter when it is triggered.
Page 22
WATER CYCLE 2021-2022
5.33 glCreateMenu():
func: The callback function for the menu that is called when a menu entry from the menu
is selected. The value passed to the callback is determined by the value for the selected
menu entry.
glutCreateMenu creates a new pop-up menu and returns a unique small integer identifier.
The range of allocated identifiers starts at one. The menu identifier range is separate from
the window identifier range. Implicitly, the current menu is set to the newly created
menu. This menu identifier can be used when calling glutSetMenu.
When the menu callback is called because a menu entry is selected for the menu,
the current menu will be implicitly set to the menu with the selected entry before the
callback is made.
5.34 glutAddMenuEntry():
PARAMETERS:
value: Value to return to the menu’s callback function if the menu entry is selected.
glutAddMenuEntry adds a menu entry to the bottom of the current menu. The
string name will be displayed for the newly added menu entry. If the menu entry is
selected by the user, the menu's callback will be called passing value as the callback's
parameter.
Page 23
WATER CYCLE 2021-2022
5.35 glutAddSubMenu():
PARAMETERS:
Name: ASCII character string to display in the menu item from which to cascade the sub-
menu.
Menu: Identifier of the menu to cascade from this sub-menu menu item.
glutAddSubMenu adds a sub-menu trigger to the bottom of the current menu. The
string name will be displayed for the newly added sub-menu trigger. If the sub-menu
trigger is entered, the sub-menu numbered menu will be cascaded, allowing sub-menu
menu items to be selected.
PARAMETERS:
glutAttachMenu attaches a mouse button for the current window to the identifier of
the current menu. By attaching a menu identifier to a button, the named menu will be
popped up when the user presses the specified button. button should be one
of GLUT_LEFT_BUTTON, GLUT_MIDDLE_BUTTON,
and GLUT_RIGHT_BUTTON. Note that the menu is attached to the button by identifier,
not by reference.
Page 24
WATER CYCLE 2021-2022
5.37 glutReshapeFunc():
PARAMETERS:
glutReshapeFunc 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.
If an overlay is established for the window, a single reshape callback is generated. It is the
callback's responsibility to update both the normal plane and overlay for the window
(changing the layer in use as necessary).
When a top-level window is reshaped, subwindows are not reshaped. It is up to the GLUT
program to manage the size and positions of subwindows within a top-level window.
Still, reshape callbacks will be triggered for subwindows when their size is changed
using glutReshapeWindow.
Page 25
WATER CYCLE 2021-2022
5.38 glutKeyboardFunc():
void glutKeyboardFunc (void (*func) (unsigned char key, int x, int y));
PARAMETERS:
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.
Mark the normal plane of current window as needing to be redisplayed. The next iteration
through glutMainLoop, the window's display callback will be called to redisplay the
window's normal plane. Multiple calls to glutPostRedisplay before the next display
callback opportunity generates only a single redisplay callback. glutPostRedisplay may be
called within a window's display or overlay display callback to re-mark that window for
redisplay.
Page 26
IMPLEMENTATION CODE:
#include<windows.h>
#include<GL/glut.h>
#include<stdio.h>
#include<string.h>
#include<math.h>
#define pi 3.14159
int id=0,start=-1,quit=0,r=0,s=0,rv=0,g=0,mb=0,z=0,f2=0,f3=0,g1=0,g2=0;
float c=0,d=0,f=0,f1=0,i=0,j=0,k=50,n=0,l,m;
float arrow_flag=0,river_flag=0,exitflag=0,fflag=0,move=0,fflag1=0;
void *currentfont;
static GLfloat translate[]={0.0,0.0,0.0,0.0,0.0};
void grass3(void);
void carrow(void);
void carrowf(void);
void cloud(void);
void cloud1(void);
void condensation(void);
void display(void);
void evaporation(void);
void grass1(void);
void grass2(void);
void ground(void);
void groundwater(void);
void gwater(void);
void hill(void);
void inst(void);
void lake(void);
void land(void);
void movcloud(void);
void movfish(void);
void precipitation(void);
void rain1(void);
void rain2(void);
Page 27
void river(void);
void runoff(void);
void sarrow(void);
void sarrowf(void);
void scene1(void);
void scene2(void);
void scene3(void);
void scene4(void);
void sea(void);
void sky(void);
void snow(void);
void sun(float,float,float);
void sunrays(void);
void tarrow(void);
void tarrowf(void);
void transpiration(void);
void tree(void);
void warrow(void);
void warrowf(void);
void inst(void)
{
glClearColor(0.686274,0.933333,1.0,1.0);
glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
glClearColor(0.960784,0.870588,0.690196,1.0);
setfont(GLUT_BITMAP_TIMES_ROMAN_24);
glColor3f(0.690196,0.188235,0.376471);
drawstring(110.0,380.0,0.0,"DEPARTMENT OF COMPUTER SCIENCE AND
ENGINEERING");
drawstring(160.0,350.0,0.0,"DSATM ENGINEERING");
drawstring(200.0,320.0,0.0,"MINI PROJECT ON");
Page 28
glColor3f(0.803921,0.3607843,0.3607843);
drawstring(208.0,300.0,0.0,"WATER CYCLE");
glColor3f(0.690196,0.188235,0.376471);
drawstring(205.0,280.0,0.0,"SUBMITTED BY");
glColor3f(0.803921,0.3607843,0.3607843);
drawstring(45.0,250.0,0.0,"PRABHU DEVAR");
drawstring(320.0,250.0,0.0,"VIDYA SHREE BS");
drawstring(45.0,230.0,0.0,"1DT15CS415");
drawstring(320.0,230.0,0.0,"1DT15CS422");
glColor3f(1.0,.0,0.0);
setfont(GLUT_BITMAP_TIMES_ROMAN_24);
drawstring(195.0,205.0,0.0,"GUIDED BY");
drawstring(190.0,190.0,0.0,"RAGHU ");
glColor3f(0.0,0.0,1.0);
setfont(GLUT_BITMAP_HELVETICA_18);
drawstring(180.0,170.0,0.0,"THE WATER CYCLE");
void scene1()
{
glClearColor(1.0,1.0,1.0,1.0);
glClear(GL_COLOR_BUFFER_BIT);
sun(60.0,280.0,25.0);
land();
hill();
lake();
tree();
ground();
sea();
Page 29
glPushMatrix();
if(arrow_flag==1)
{
sunrays();
sarrowf();
}
glPopMatrix();
sky();
glutPostRedisplay();
glFlush();
}
void scene2()
{
glClearColor(1.0,1.0,1.0,1.0);
glClear(GL_COLOR_BUFFER_BIT);
hill();
sun(60.0,280.0,25.0);
land();
lake();
ground();
sea();
tree();
gwater();
cloud();
evaporation();
carrowf();
tarrowf();
transpiration();
sky();
}
void scene3()
{
glClearColor(1.0,1.0,1.0,1.0);
glClear(GL_COLOR_BUFFER_BIT);
hill();
sun(60.0,280.0,25.0);
land();
lake();
ground();
tree();
sea();
Page 30
gwater();
condensation();
movcloud();
cloud();
sky();
}
void scene4()
{
glClearColor(1.0,1.0,1.0,1.0);
glClear(GL_COLOR_BUFFER_BIT);
snow();
if(r==1)
rain2();
else
rain1();
precipitation();
hill();
if(river_flag==1)
{
river();
runoff();
warrowf();
groundwater();
gwater();
}
sun(60.0,280.0,25.0);
land();
lake();
ground();
tree();
sea();
cloud1();
sky();
}
Page 31
glFlush();
}
void land()
{
glColor3f(0.0,1.0,0.0);
glBegin(GL_POLYGON);
glColor3f(0.960784,0.870589,0.701961);
glVertex2f(325.0,57.5);
glVertex2f(287.5,65.0);
glVertex2f(275.0,75.0);
glVertex2f(245.0,95.0);
glVertex2f(211.0,107.5);
glVertex2f(175.0,125.0);
glColor3f(0.0,1.0,0.0);
glVertex2f(187.5,125.0);
glVertex2f(200.0,127.5);
glVertex2f(205.0,129.0);
glVertex2f(215.0,131.0);
glVertex2f(225.0,133.5);
glVertex2f(230.0,134.5);
glVertex2f(232.5,135.5);
glVertex2f(235.0,137.0);
glVertex2f(240.0,139.0);
glVertex2f(250.0,140.0);
glVertex2f(252.5,140.0);
glVertex2f(255.0,142.0);
glVertex2f(257.5,142.0);
glVertex2f(260.0,142.0);
glVertex2f(262.5,143.0);
glVertex2f(265.0,143.0);
glVertex2f(270.5,143.0);
glVertex2f(272.5,143.0);
glVertex2f(275.0,143.0);
glVertex2f(282.5,145.0);
glVertex2f(285.0,145.0);
glVertex2f(290.0,144.0);
glVertex2f(295.0,143.0);
glVertex2f(300.0,143.0);
glVertex2f(320.0,143.0);
glVertex2f(325.5,145.0);
glVertex2f(327.5,146.5);
glVertex2f(330.0,147.5);
Page 32
glVertex2f(332.5,148.0);
glVertex2f(335.5,148.0);
glVertex2f(337.5,148.0);
glVertex2f(342.5,150.0);
glVertex2f(345.0,153.5);
glVertex2f(350.5,155.0);
glVertex2f(355.5,157.0);
glVertex2f(360.5,165.0);
glVertex2f(365.5,161.5);
glVertex2f(371.0,155.5);
glVertex2f(378.0,154.0);
glVertex2f(386.0,153.0);
glVertex2f(392.5,155.0);
glVertex2f(399.0,162.5);
glVertex2f(437.0,178.7);
glVertex2f(500.0,187.0);
glVertex2f(500.0,70.0);
glVertex2f(500.0,65.0);
glEnd();
glFlush();
}
void hill()
{
glPushMatrix();
glScaled(1.2,1.8,0);
glRotated(350,0.5,0,1);
glTranslated(-90,-25,0);
glPushMatrix();
glColor3f(0.737255,0.560784,0.560784);
glBegin(GL_POLYGON); //first hill
glVertex2f(500.0,187.5);
glVertex2f(497.5,190.0);
glVertex2f(495.0,200.0);
glVertex2f(492.5,205.0);
glVertex2f(490.0,210.0);
glVertex2f(485.0,215.0);
glVertex2f(482.5,220.0);
glVertex2f(480.0,225.0);
glVertex2f(477.5,230.0);
glVertex2f(475.0,235.0);
glVertex2f(470.0,230.0);
glVertex2f(465.0,220.0);
Page 33
glVertex2f(462.5,210.0);
glVertex2f(460.0,200.0);
glVertex2f(455.5,190.0);
glVertex2f(452.0,185.0);
glVertex2f(450.0,182.5);
glVertex2f(448.0,180.0);
glVertex2f(445.0,178.0);
glVertex2f(437.5,178.0);
glVertex2f(437.4,178.0);
glVertex2f(437.3,178.1);
glVertex2f(437.1,178.3);
glVertex2f(437.0,178.7);
glEnd();
glPopMatrix();
glFlush();
glPushMatrix();
glColor3f(0.737255,0.560784,0.560784);
glBegin(GL_POLYGON); //second hill
glVertex2f(437.9,178.7);
glVertex2f(435.2,179.0);
glVertex2f(433.0,181.0);
glVertex2f(431.6,185.0);
glVertex2f(429.5,188.0);
glVertex2f(427.0,190.0);
glVertex2f(425.0,195.0);
glVertex2f(423.5,200.3);
glVertex2f(422.0,205.0);
glVertex2f(421.0,207.5);
glVertex2f(420.0,210.5);
glVertex2f(419.0,207.5);
glVertex2f(418.0,205.0);
glVertex2f(416.7,200.3);
glVertex2f(414.5,190.0);
glVertex2f(412.5,185.0);
glVertex2f(410.6,180.0);
glVertex2f(405.5,170.0);
glVertex2f(400.5,168.0);
glVertex2f(399.0,162.5);
glEnd();
glPopMatrix();
glFlush();
}
Page 34
int main(int argc,char **argv)
{
glutInit(&argc,argv);
glutInitDisplayMode(GLUT_DOUBLE|GLUT_RGBA|GLUT_DEPTH);
glutInitWindowSize(1000,1000);
glutCreateWindow("WATER CYCLE");
init();
glutDisplayFunc(display);
glutMouseFunc(mouse);
glutKeyboardFunc(keys);
glutPostRedisplay();
glEnable(GL_DEPTH_TEST);
glEnable(GL_BLEND); //for transparency
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glutMainLoop();
}
Page 35
CHAPTER 6
SNAPSHOTS
IMAGE 1 :
IMAGE 2:
FIG 6.2: Process of evaporation from sea and transpiration from plants/trees
Page 36
IMAGE 3:
IMAGE 4:
Page 37
IMAGE 5:
Page 38
CHAPTER 7
CONCLUSION
SCOPE OF IMPROVEMENT:
Though the package that is designed here does not include complex
OpenGL package, we intend to improve this by including extra features like
lighting effects. Changing the background color adding alarms. We do this
with an aim to attract more people to use our package.
Page 39
BIBLIOGRAPHY
BOOK REFERENCES:
WEBSITE REFERENCES:
[1] - https://www.khronos.org/opengl/wiki/Getting_Started
[2] - https://www.opengl.org/sdk/docs/tutorials/OGLSamples/
[3] - https://www.geeksforgeeks.org/getting-started-with-opengl/
[4] - https://www.khronos.org/opengl/wiki//Code_Resources
[5] - http://www.lighthouse3d.com/tutorials/glut-tutorial/
[6] - http://code-blocks.blogspot.in/2014/12/bresenhams-circle-drawing-algorithm.html
[7] - https://github.com/sprintr/opengl-examples/blob/master/OpenGL-Menu.cpp
Page 40