Professional Documents
Culture Documents
Chapter - 1
Chapter - 1
CHAPTER - 1
INTRODUCTION
1.1 Aim
The main aim of this project “Volcanic Eruption” demonstrates the working model of
a two-dimensional volcano in day and night with keyboard interaction.
1.2 Overview
This project shows the design in OpenGL. Volcanic Eruption is a natural phenomenon
that occurs in nature. On Earth, volcanoes are most often found where tectonic plates are
diverging or converging, and most are found underwater. Volcanoes often form a hill or
mountain as layers of rock and ash build up from repeated eruptions. They are made of small
pieces of solid lava, called cinder. On land, volcanoes form when one tectonic plate moves
under another. Usually a thin, heavy oceanic plate subducts, or moves under, a thicker
continental plate. When this happens, the ocean plate sinks into the mantle.
1.3 Outcome
Through the OpenGL Programming we are able to demonstrate the working of the
volcano and its eruption. By studying the nature of the volcano in different situations like
day and night. By demonstrating general knowledge and understanding of the hazards
posed by volcanic eruption.
CHAPTER – 2
Step 1: Start
Step 5: Invoke Display Function and with the use of required API’S.
Step 6: Initialize values of x, y, *format to stroke output function providing stroke character.
Step 7: Declare global variables i, j, k, x, y, n1, n2 and initialize their respective value.
Step 8: Construct Hills, trees, clouds, house, water, sun with all properties included using
respective model.
#include<mmsystem.h>
#include<GL\glut.h>
#include <GL/glu.h>
#include<math.h>
#include <stdlib.h>
#include<stdio.h>
#define PI 3.1416
GLint i, j, k,x=0,y=0,speed=0,alt=0,n1=1000,n2=1100,s1=0,s2=1,s3=1;
GLfloat ax=0,bx=0,cx=0,dx=0,str=500.0,mn=500.0;
GLfloat sr=0.0,sg=0.749,sb=1.0;
bool condition=false;
void init(void)
glMatrixMode(GL_PROJECTION);
return x=4,y=8;
return x=0,y=0;
y= 8.0f;
glutPostRedisplay();
x=4.0f;
glutPostRedisplay();
void brown_hill()
glPushMatrix();
glTranslatef(0,-220,0);
glScaled(0.8,0.76,0);
glBegin(GL_POLYGON);
glBegin(GL_POLYGON);
glBegin(GL_POLYGON);
glPopMatrix();
glEnd();
void fire(){
glBegin(GL_POLYGON);
glVertex2f(13.5,0.0);
glVertex2f(8,10);
glVertex2f(15,4);
glVertex2f(17, 10);
glVertex2f(19,4);
glVertex2f(26.0,10);
glVertex2f(20.5, 0.0);
glEnd();
void Sun_Model(){
glPushMatrix();
glTranslatef(600,1100,0);
circle(33);
glPopMatrix();
//position2 -= 5;
if(position2 <-1.3)
position2 -= _move2;
void fire1(){
glPushMatrix();
glTranslatef(63,390,0);
glScaled(y,y,0);
fire();
glPopMatrix();
void display(void)
glClear(GL_COLOR_BUFFER_BIT);
night();
brown_hill();
Sun();
fire1();
fire2();
tree();
hill_volkano();
cloud_three();
cloud_four();
Windmill_One();
Windmill_Two();
Tilla_Two();
Tilla_Three();
cloud_one();
house2();
Tree_One();
Tree_Two();
Tree_Three();
Tree_Four();
cloud_two();
cloud_five();
cloud_six();
field();
glFlush();
void move_right()
ax = ax + .05;
bx = bx + .08;
cx = cx + .10;
dx = dx + .15;
if(cx>1000){
cx = -300;
if(bx>1000){
bx= -400;
if(cx>1000){
cx= -400;
if(dx>1000){
dx= -500;
glutPostRedisplay();
switch (key)
case GLUT_LEFT_BUTTON:
if (state == GLUT_DOWN)
glutIdleFunc(move_right);
break;
case GLUT_MIDDLE_BUTTON:
case GLUT_RIGHT_BUTTON:
if (state == GLUT_DOWN)
glutIdleFunc(NULL);
break;
default:
break;
switch (key) {
case 'f':
r(1);
break;
case 'g':
r(1,1);
break;
case 'n':
updatex();
condition=true;
break;
case 'd':
updatex1();
condition=false;
break;
glutPostRedisplay();
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB);
glutInitWindowPosition(50, 50);
glutInitWindowSize(1800, 900);
glutCreateWindow("Volcanic Eruption");
init();
glutDisplayFunc(display);
glutMouseFunc(mouse);
glutKeyboardFunc(handleKeypress);
glutMainLoop();
CHAPTER – 3
RESULT ANALYSIS
3.1 Snap Shots
General view of volcano.
3.2 Discussion
1. Fig 3.1: Displays the volcanic mountain with a scene consisting of house, windmill,
clouds, sun, water, and hills.
• When the user clicks ‘d’ from the keyboard the scene turns to day if it was in night
mode.
• When the user clicks ‘f’ from the keyboard shows the volcanic eruption.
• When the user clicks ‘g’ from the keyboard the eruption disappears.
• When the user clicks ‘n’ from the keyboard the scene turns to night if it was in day
mode.
• When the user clicks ‘f’ from the keyboard shows the volcanic eruption.
• When the user clicks ‘g’ from the keyboard the eruption disappears.
CHAPTER – 4
▪ The project can be further developed to change the colour of the objects and also, we can
give the background effect as well.
CHAPTER – 5
REFERENCE
We have obtained information from many resources to design and implement our project
successively. We have acquired most of the knowledge from related websites. The
following are some of the resources:
➢ Text Books: interactive computer graphics a top-down approach -by Edward angel.
➢ computer graphics, principles & practices - foley van dam - Feiner Hughes.
➢ Web References:
http://jerome.jouvie.free.fr/opengl/lessons/lesson3.php
http://google.com
http://opengl.org