Sie sind auf Seite 1von 12

PROJECT REPORT

CONTENTS
1.INTRODUCTION
2.PROJECT DEFINITION AND DESCRPTION
3.DESIGN AND IMPLEMENTATION
4.RESULTS AND SNAPSHOTS
5.CONCLUSION
6.REFERENCE

1.INTRODUCTION
1.1 INTRODUCTION TO COMPUTER GRAPHICS

In recent years computer graphics is comprehensively applicable in


almost all fields design, movie making, gaming , as simulators and so on...
In scientific world, it has become inevitable in order to study the structure
of atoms of an element, and their arrangement. Now, we can create images
by computer that are indistinguishable from photographs of objects. In
gaming and movie making they need movements of objects.
Computer graphics is widely used in
1. display of information.
2. design of interactive graphic tool such as CAED and VLSI.
3. simulation and animation of objects..
4. user interfaces.

1.2 INTRODUCTION TO PROJECT


Project volcanic erruption makes use of all opengl functions.
Feature length movies made entirely by computer have been
successful both critically &Financially. Cartographers need computer
graphics in geographical mapping, which is helpful In one of the emerging
technology called Geographical Information
Systems(GIS). We use
Graphics in our mini project to illustrate the entire process of volcanic
eruption.

1.3 INTRODUCTION TO OPENGL


Open Graphic Library is a cross language,multiplatform API
for ordinaru 2D and 3D computer graphics .The API is
typically used to interact with CPU to achieve hardware
accelearted ordering scientific visualising light simulation.
API contains major group of functions
a.Primitive fuction
b.Attribute function
c.Input function
d.Control function
e.Query function

2.PROJECT DEFINITION AND DESCRPTION


2.1 PROBLEM definition
Program to illustrate the complete process of volcano
erruption by making use of different functions of OPENGL
2.2 PROJECT DESCRYPTION

We use a particular graphics software system, OpenGL which has


become a widely accepted standard for developing graphics applications.
The underlying project is based on the the concept of Volcanic
Eruption.
In this project we have used objects such as mountain, burst,
sea, stones and tree. In this Project we will illustrate the entire process of
volcanic eruption. We have implemented this in such a way that it depicts
the entire process very clearly right from lava creation due to the heated
earth in some thin parts of the earth to how stones are formed when the
volcanic eruption takes place.
2.3 REQUIREMENTS
Hardware Requirements:Color Monitor,Keyboard,Mouse.
Software Requirements:DevC++, glut.

3.DESIGN AND IMPLEMENTATION


First we initialize the window by using function glutInit(). OpenGl is
initialized by using function openGlInit(). We adjust windowPosition and
size by using OpenGl library functions glutWindowsize() and
glutWindowPosition(). The keyboard interface is initialized by using the
function glutKeyboardFunc().
We draw the mountain using the mountain() by defining the vertices
and later calling the smoke and lava function in it. In the burst function we
define the lava points and vertices and we write the text using the
GLUT_BITMAP_TIMES_ROMAN. We draw the smoke using the
smoke() function and we draw the sea by using the sea() function. We draw
the tree using the tree() function and we draw the stones using the stone
function().
METHODOLOGY

3.2 DIFFERENT OPEN GL FUNCTIONS USED


a.glut Init():
initializes glut.The arguments from main are passed in and can be used
by the application.
b. glutInitWindowsize():
specifies the initial height and width of the window in pixels.
c.glutInitWindowPosition():
specifies the initial position of the top left corner of the window in pixels
d.glutKeyboardFunc():
registers the keyboard callback function f.The callback
returns the ASCII code of the key pressed.
e.GLUT_BITMAP_TIMES_ROMAN:we write the text using this
function which can be seen in dispaly window.
f.glutDisplayFunc():
registers the display function func that is executed when the window
needs to be redrawn.
g.glutIdleFunc(idle):
registers the display callback function f that is executed whenever there
is no other events to be handled
h.glutMainLoop():
cause the program to enter an event processing loop.

4.RESULTS and SNAPSHOTS


We have Illustrated the entire Process of Volcanic eruption, right from
lava eruption from the mountain to stone formation.

5.CONCLUSION
An attempt has been made to develop an OpenGL graphics package, which
meets the necessary requirements of the user successfully. We try to
implement major properties of CG such as transformation and viewing. It
enables us to learn about the basic concepts in graphics and know standard
library graphics functions and also to explore some other functions. Since it

is user friendly, it enables the user to interact efficiently and easily. Thus, the
program designed here, provides ultimate options of transformation and
viewing. Further this project can be advanced by adopting a better GUI
which may look pleasing.

6.REFERENCES:
1.
Interactive Computer Graphics A Top-Down Approach with OpenGLEdward Angel, 5th Edition, Addision-Wesley, 2008.
2.
Computer Graphics - OpenGL Version - Donald Hearn and Pauline
Baker, 2nd Edition, Pearson Education.
3.
OpenGl version Donald Hearn and Pauline Baker, 2 Edition Pearson
Education, 2003, Computer Graphics

PROGRAM:
#include<stdio.h>
#include<GL/glut.h>
#include<stdlib.h>
GLint r,q,k1,p,x,y,a;
void smoke()
{
glBegin(GL_POLYGON); //smoke cloud
glColor3f(0.7,0.7,0.7);
glVertex2d(640,870);
glVertex2d(655,845);
glVertex2d(675,835);
glVertex2d(695,830);
glVertex2d(715,830);
glVertex2d(735,835);
glVertex2d(750,850);
glVertex2d(775,845);
glVertex2d(800,855);
glVertex2d(810,865);
glVertex2d(825,880);
glVertex2d(825,900);
glVertex2d(810,920);
glVertex2d(790,930);
glVertex2d(770,935);
glVertex2d(755,935);
glVertex2d(740,945);

glVertex2d(725,955);
glVertex2d(705,960);
glVertex2d(685,955);
glVertex2d(670,945);
glVertex2d(660,930);
glVertex2d(630,940);
glVertex2d(605,935);
glVertex2d(585,925);
glVertex2d(570,905);
glVertex2d(575,885);
glVertex2d(590,870);
glVertex2d(615,860);
glEnd();
glBegin(GL_POLYGON); //smoke
glColor3f(0.8,0.8,0.8);
glVertex2d(725,740+q);
glVertex2d(690,765+q);
glVertex2d(700,765+q);
glVertex2d(690,790+q);
glVertex2d(735,790+q);
glVertex2d(725,765+q);
glVertex2d(735,765+q);
glVertex2d(725,740+q);
glEnd();
glColor3f(0.2,0.2,0.2);
glRasterPos2f(715,790);
glutBitmapCharacter(GLUT_BITMAP_TIMES_ROMAN_24,'S');
glutBitmapCharacter(GLUT_BITMAP_TIMES_ROMAN_24,'M');
glutBitmapCharacter(GLUT_BITMAP_TIMES_ROMAN_24,'O');
glutBitmapCharacter(GLUT_BITMAP_TIMES_ROMAN_24,'K');
glutBitmapCharacter(GLUT_BITMAP_TIMES_ROMAN_24,'E');
}
void lava()
{
glBegin(GL_LINES);
glColor3f(1.0,0.0,0.0); //lava
glLineWidth(1.0);
glBegin(GL_LINES);
glVertex2i(675-x,760+y); //left
glVertex2i(645-x,790+y);
glVertex2i(640-x,755+y);
glVertex2i(620-x,785+y);
glVertex2i(660-x,755+y);
glVertex2i(640-x,785+y);

glVertex2i(715+x,755+y); //right
glVertex2i(735+x,785+y);
glVertex2i(730+x,755+y);
glVertex2i(750+x,785+y);
glVertex2i(750+x,760+y);
glVertex2i(770+x,790+y);
glVertex2i(690-x,760+y);//left
glVertex2i(650-x,800+y);
glEnd();
glColor3f(1.0,0.0,0.0); //lava
glLineWidth(5.0);
glVertex2i(700,750); //left
glVertex2i(675,770);
glVertex2i(630,785);
glEnd();

}
void sea()
{

glColor3f(0.0,0.7,1.0); //sea
glBegin(GL_POLYGON);
glVertex2i(0,0);
glVertex2i(0,400);
glVertex2i(300,450);
glVertex2i(300,0);
glVertex2i(0,0);
glEnd();
glColor3f(0.0,0.7,1.0); //waves
glBegin(GL_POLYGON);
glVertex2i(0+p,400);
glVertex2i(325+p,465);
glVertex2i(315+p,440);
glVertex2i(340+p,420);
glVertex2i(310+p,400);
glVertex2i(400+p,350);
glVertex2i(315+p,370);
glVertex2i(420+p,350);
glVertex2i(325+p,300);
glVertex2i(410+p,250);
glVertex2i(335+p,200);
glVertex2i(350+p,140);
glVertex2i(0+p,0);

glVertex2i(0+p,300);
glEnd();
glColor3f(0.0,0.0,0.0);
glBegin(GL_POLYGON);
glVertex2d(350,320);
glVertex2d(350,360);
glVertex2d(370,370);
glVertex2d(390,340);
glVertex2d(370,320);
glEnd();
glColor3f(0.0,0.0,0.0);
glBegin(GL_POLYGON);
glVertex2d(350,270);
glVertex2d(370,300);
glVertex2d(340,310);
glVertex2d(320,300);
glVertex2d(340,310);
glVertex2d(350,270);
/*
glVertex2d(860,400);
glVertex2d(860,300);*/
glEnd();
}
void mountain()
{
glColor3f(0.27,0.0,0.1);
glBegin(GL_POLYGON); //1st mountain
glVertex2i(0,600);
glVertex2i(200,800);
glVertex2i(400,600);
glVertex2i(0,600);
glEnd();
glColor3f(0.28,0.0,0.1); //2nd mountain
glBegin(GL_POLYGON);
glVertex2i(300,700);
glVertex2i(450,850);
glVertex2i(700,600);
glVertex2i(400,600);
glVertex2i(300,700);
glEnd();
lava();

smoke();

glColor3f(0.28,0.0,0.1); //3rd mountain


glBegin(GL_POLYGON);
glVertex2i(590,700);
glVertex2i(675,750);

glVertex2i(750,750);
glVertex2i(950,600);
glVertex2i(700,600);
glVertex2i(590,700);
glEnd();
glColor3f(1.0,0.0,0.0);
glBegin(GL_POLYGON);
glVertex2i(705,750);
glVertex2i(720,750);
glVertex2i(720,600);
glVertex2i(420,350);
//glVertex2i(40,350);
glVertex2i(315,370);
glVertex2i(400,350);

//

glVertex2i(710,600);
glVertex2i(705,750);
glVertex2i(720,750);
glEnd();

}
void burst()
{

glColor3f(1.0,0.2,0.0); //lava (points)


glPointSize(5.0);
glBegin(GL_POINTS);
glVertex2i(725,650-r);
glVertex2i(650,625-r);
glVertex2i(840,625-r);
glVertex2i(820,635-r);
glVertex2i(750,625-r);
glVertex2i(740,615-r);
glVertex2i(650,690-r);
glVertex2i(660,615-r);
glVertex2i(715,675-r);
glVertex2i(720,680-r);
glVertex2i(815,615-r);
glVertex2i(805,690-r);
glVertex2i(815,650-r);
glVertex2i(920,605-r);
glVertex2i(880,710-r);
glVertex2i(895,690-r);
glVertex2i(960,615-r);
glVertex2i(955,625-r);
glVertex2i(900,705-r);
glVertex2i(880,710-r);
glVertex2i(895,690-r);
glVertex2i(800,725-r);
glVertex2i(790,735-r);
glEnd();
glColor3f(0.28,0.4,0.4);
glRasterPos2f(725,650);

glutBitmapCharacter(GLUT_BITMAP_TIMES_ROMAN_24,'L');
glutBitmapCharacter(GLUT_BITMAP_TIMES_ROMAN_24,'A');
glutBitmapCharacter(GLUT_BITMAP_TIMES_ROMAN_24,'V');
glutBitmapCharacter(GLUT_BITMAP_TIMES_ROMAN_24,'A');

}
void stones()
{
glColor3f(0.0,0.0,0.0); //stone
glBegin(GL_POLYGON);
glVertex2d(270,290);
glVertex2d(290,350);
//glVertex2d(300,370);
glVertex2d(230,365);
glVertex2d(170,370);
glVertex2d(200,300);
glVertex2d(270,290);
glEnd();
glColor3f(1.0,1.0,1.0);
glRasterPos2f(320,320);
glutBitmapCharacter(GLUT_BITMAP_TIMES_ROMAN_24,'S');
glutBitmapCharacter(GLUT_BITMAP_TIMES_ROMAN_24,'T');
glutBitmapCharacter(GLUT_BITMAP_TIMES_ROMAN_24,'O');
glutBitmapCharacter(GLUT_BITMAP_TIMES_ROMAN_24,'N');
glutBitmapCharacter(GLUT_BITMAP_TIMES_ROMAN_24,'E');
glColor3f(1.0,1.0,1.0);
glRasterPos2f(270,280);
glutBitmapCharacter(GLUT_BITMAP_TIMES_ROMAN_24,'F');
glutBitmapCharacter(GLUT_BITMAP_TIMES_ROMAN_24,'O');
glutBitmapCharacter(GLUT_BITMAP_TIMES_ROMAN_24,'R');
glutBitmapCharacter(GLUT_BITMAP_TIMES_ROMAN_24,'M');
glutBitmapCharacter(GLUT_BITMAP_TIMES_ROMAN_24,'A');
glutBitmapCharacter(GLUT_BITMAP_TIMES_ROMAN_24,'T');
glutBitmapCharacter(GLUT_BITMAP_TIMES_ROMAN_24,'I');
glutBitmapCharacter(GLUT_BITMAP_TIMES_ROMAN_24,'O');
glutBitmapCharacter(GLUT_BITMAP_TIMES_ROMAN_24,'N');
}
void tree()
{
glColor3f(0.7,0.5,0.2);
glBegin(GL_POLYGON);
//tree
glVertex2d(830,300);
glVertex2d(830,400);
glVertex2d(860,400);
glVertex2d(860,300);
glEnd();
glColor3f(0.0,0.7,0.0);
glBegin(GL_POLYGON);
glVertex2d(830,400);
glVertex2d(800,375);
glVertex2d(810,370);
glVertex2d(780,400);

glVertex2d(800,425);
glVertex2d(795,450);
glVertex2d(820,470);
glVertex2d(820,495);
glVertex2d(850,520);
glVertex2d(850,515);
glVertex2d(875,500);
glVertex2d(880,475);
glVertex2d(905,455);
glVertex2d(895,430);
glVertex2d(910,400);
glVertex2d(885,375);
glVertex2d(860,400);
glEnd();
}
void display()
{
glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
mountain();
burst();
sea();
stones();
tree();
glFlush();
glutSwapBuffers();
}
void idle()
{
if(q<=150) // smoke
q+=1.0;
else
{
q=0;
q-=0.01;
}
if(p<=10) // sea
p+=1.0;
else
{
p=0;
p-=0.9;
}
if(r<=60) // lava(particals)
r+=1.2;
else
{

r-=0.9;
}
else
{

r=0;
if(x<=100) //lava strip
x+=1.0;
x=0;
x-=0.9;

}
if(y<=100)
y+=1.0;
else
{
y=0;
y-=0.9;
}
glFlush();
glutPostRedisplay();

void init()
{
glClearColor(0.4,0.5,0.6,0.0);
//glColor3f(0.4,0.6,0.8);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluOrtho2D(0.0,999.0,0.0,999.0);
}
int main(int argc,char **argv)
{
glutInit(&argc,argv);
glutInitDisplayMode(GLUT_DOUBLE|GLUT_RGB);
glutInitWindowSize(1000,1000);
glutInitWindowPosition(0,0);
glutCreateWindow("Volcanic Eruption");
glutDisplayFunc(display);
glutIdleFunc(idle);
init();
glutMainLoop();
}

Das könnte Ihnen auch gefallen