Professional Documents
Culture Documents
A Mini-Project Report on
“Volcanic Eruption”
Submitted in partial fulfillment for the Computer Graphics Laboratory with
Mini-Project (18CSL67) course of Sixth Semester of Bachelor of Engineering
in Computer Science & Engineering during the academic year 2021-22.
By
Team Code: CGP2022-C06
Yashas D 4MH19CS120
Dheemanth Hr 4MH19CS027
Accredited By:
2021-22
DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING
MAHARAJA INSTITUTE OF TECHNOLOGY MYSORE
~~ CERTIFICATE ~~
_________________ _________________
Signature of Guide Signature of the HOD
External viva
Name of the Examiners Signature with date
1)………………………………………………………………………………
2) ………………………………………………………………………………
~~~~ ACKNOWLEDGEMENT ~~~~
It is the time to acknowledge all those who have extended their guidance,
inspiration, and their wholehearted co-operation all along our project work.
Our gratitude will not be complete without thanking our parents and our
friends, who have been a constant source of support and aspirations
Yashas D
Dheemanth Hr
~~~ ABSTRACT ~~~
In this project the main aim is to illustrate the concepts and usage of pre-built
functions in OpenGL. Creating Figures like “VOLCANO” where the idea behind this
project is to display the aquarium with computer graphics. This graphics package is
based on the OpenGL library functions. The programming language used here is C
using OpenGL libraries. In this project, we are demonstrating the screensaver in which
we can toggle between day and night with the pressing of “n” button and “d” button.
In this project we imposed the idea of volcanic eruption and implemented the
same using OpenGL. This is achieved with basic two-dimensional shapes and some
transformation using translations. These translations are achieved with the interaction
of the keyboard. The different shadow effects can easily differentiate between different
figures of the project. User interaction with keyboard helps us easily understand the
before and after scenario of the volcanic eruption.
~~~~~ CONTENTS ~~~~~
1. INTRODUCTION ………………………………...……………… 01
1.1 Aim of the Project …………………………...………….… 01
1.2 Overview of the Project……………….……………...…… 01
1.3 Outcome of the Project……………….….…………...…… 01
5. REFERENCES …….…………………………...………………… 18
Volcanic Eruption Computer Graphics Laboratory with Mini-Project [18CSL67]
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