0% found this document useful (0 votes)
124 views26 pages

Yashu CG Report-1

This document is a mini project report on an Aquarium Simulation created using OpenGL. It was submitted by two students, Yashaswini L and Zainab Y, in partial fulfillment of their Bachelor of Engineering degree in Computer Science and Engineering. The report includes an introduction to computer graphics, literature survey of previous aquarium simulations, requirements analysis, implementation details, screenshots of the simulation, references, and appendices. The 2D animation simulates an aquarium with moving fish, bubbles, grass, and a crab. Users can add or remove fish and empty the tank via a menu.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
124 views26 pages

Yashu CG Report-1

This document is a mini project report on an Aquarium Simulation created using OpenGL. It was submitted by two students, Yashaswini L and Zainab Y, in partial fulfillment of their Bachelor of Engineering degree in Computer Science and Engineering. The report includes an introduction to computer graphics, literature survey of previous aquarium simulations, requirements analysis, implementation details, screenshots of the simulation, references, and appendices. The 2D animation simulates an aquarium with moving fish, bubbles, grass, and a crab. Users can add or remove fish and empty the tank via a menu.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 26

VISVESVARAYA TECHNOLOGICAL UNIVERSITY

“Jnana Sangama”, Belagavi – 590018, Karnataka

A MINI PROJECT REPORT


ON
“AQUARIUM SIMULATION”
Submitted in partial fulfilment of the requirements for the

COMPUTER GRAPHICS LABORATORY WITH MINI PROJECT


[18CSL67]
Bachelor of Engineering
in
COMPUTER SCIENCE & ENGINEERING

Submitted by:
Ms. Yashaswini L[1JT20CS119]
Ms. Zainab Y[1JT20CS120]

Under the Guidance of


Mr. Navile Nageshwara Naveen
Assistant Professor
Department of Computer Science and Engineering

Jyothy Institute of Technology


Department of Computer Science and Engineering
Accredited by NBA, New Delhi
Tataguni, Off. Kanakapura Road,
Bengaluru – 560 082
2022 – 2023
JYOTHY INSTITUTE OF TECHNOLOGY
Department of Computer Science and Engineering
Accredited by NBA, New Delhi
Tataguni, Off. Kanakapura Road,
Bengaluru – 560082

Institution Vision & Mission

Vision of the Institution

To be an institution of excellence in Engineering education, Innovation and Research and work


towards evolving great leaders for the country’s future and meeting global needs.

Mission of the Institution

The Institution aims at providing a vibrant, intellectually and emotionally rich teaching learning
environment with state of art infrastructure and recognizing and nurturing the potential of each
individual to evolve into one’s own self and contribute to the welfare of all.

Department of CS&E Vision & Mission

Vision of the Department

To be a centre of excellence in Computer Science and Engineering education, focus on


research, innovation and entrepreneurial skill development with professional competency.

Mission of the Department


The Department will
M1: To provide state of the art ICT infrastructure and innovative, research oriented teaching
learning environment and motivation for self-learning & problem solving abilities by recruiting
committed faculty.
M2: To Encourage Industry Institute Interaction & multi-disciplinary approach to problem
solving and adapt to the ever changing global IT trends.
M3: To Imbibe awareness on societal responsibility and leadership qualities with professional
competency and ethics
JYOTHY INSTITUTE OF TECHNOLOGY
Department of Computer Science and Engineering
Accredited by NBA, New Delhi

Tataguni, Off. Kanakapura Road, Bengaluru - 560 082

CERTIFICATE
This is to certify that the mini project entitled ‘AQUARIUM’ carried out by Ms. Yashaswini L
[1JT20CS119], Ms. Zainab Y [1JT20CS120], a bonafide students of Jyothy Institute of Technology,
Bengaluru in partial fulfillment for Computer Graphics Laboratory with Mini Project (18CSL67) of
Bachelor of Engineering, in Computer Science and Engineering under Visvesvaraya Technological
University, Belagavi, during the year 2022-2023. It is certified that all corrections/suggestions indicated
have been incorporated in the report.

The report has been approved as it satisfies the academic requirements in respect of Mini Project,
prescribed for the said Bachelor's degree.

Signature of Guide Signature of HoD

Mr. Navile Nageshwara Dr. Prabhanjan S


Professor & HoD
Naveen Dept., of CSE
Assistant Professor
JIT, Bengaluru
Dept., of CSE
JIT, Bengaluru
External Viva

Name of Examiners Signature with Date


1.

2.
DECLARATION

We, Ms. Yashaswini L, Ms. Zainab Y, students of 6th semester of Computer Science
and Engineering, Jyothy Institute of Technology, Tataguni, Bangalore - 560 082, declare that
the entire mini project “AQUARIUM” embodied in this report has been successfully
completed under the guidance of Mr. Navile Nageshwara Naveen, Assistant Professor ,
Dept of CSE, JIT, Bangalore. This mini project is submitted to the department of Computer
Science and Engineering, Jyothy Institute of Technology, Tataguni, Bangalore, in partial
fulfillment of the requirements for course Computer Graphics laboratory with mini project
(18CSL67), during the academic year 2022-2023.

Place: Bangalore

Date: 08/07/2023

Ms. Yashaswini L [ 1JT20CS119 ]

Ms. Zainab Y [ 1JT20CS120 ]


ACKNOWLEDGEMENT

This mini project is a result of accumulated guidance, direction and support of several important
persons. We take this opportunity to express our gratitude to all who have helped us to complete this
mini project.

We express our sincere thanks to our Principal Dr K Gopalakrishna, for providing us adequate
facilities to undertake this mini project.

We would like to thank Dr. Prabhanjan S, Professor and Head of Dept., - CSE, for providing us an
opportunity to carry out this mini project and for his valuable guidance and support.

We express our deep and profound gratitude to our guide, Mr. Navile Nageshwara Naveen, Asst.
Prof., Dept., of CSE, for his keen interest and encouragement at every step in completing the mini
project work.

We would like to thank all the faculty members of CSE department for the support extended during the
course of the mini project.

Ms. Yashaswini L [ 1JT20CS119 ]

Ms. Zainab Y [ 1JT20CS120 ]


ABSTRACT

The development of any project will improve the users’ knowledge. The main aim of
developing this project is to improve our knowledge of Computer Graphics and OpenGL.
This project provides good understanding of conspicuous OpenGL functions like
Transformation Matrices, Translation, Rotation and Scaling.

Keeping factors of usability and simplicity in mind, the demonstrations of the basic
OpenGL functions and features are demonstrated.This project will demonstrate the use
of two- and three-dimensional planes in OpenGL. This project has detailed information
on user interaction.

This is a menu driven, two-dimensional animation of an aquarium. On running this


project, a window with moving fishes in an aquarium is displayed. The aquarium consists
of air bubbles which will be moving in an upward direction. We have placed an
animation of grass and a moving crab at the bottom of the aquarium.We have also added
a decorative star at bottom-right to make the aquarium look complete.

The menu provides options to add fishes to the aquarium by the count of one, remove
fishes from the aquarium by the count of one, empty the tank completely resulting in zero
fishes, and the Quit option which will close the window. The fishes are assigned various
colors using a two-dimensional array and they make a motion with random speed.

Similarly, the bubbles and the crab also move with random speed. While the grass shows
a movement at the bottom-left of the aquarium with some angle, the decorative star is
static.
TABLE OF CONTENTS

Sl no. Description Page no.


1 INTRODUCTION 1

2 LITERATURE SURVEY 7

3 REQUIREMENT ANALYSIS 9

4 IMPLEMENTATION 11

5 SNAPSHOTS 13

6 REFERENCES 17

7 APPENDIX 18
Aquarium Simulation

CHAPTER 1
INTRODUCTION

1.1 Introduction to Computer Graphics


Computer Graphics started with the display of data on hardcopy plotters and
cathode ray tube screens soon after the introduction of computer themselves. Now it has
grown to that extent that it has included the creation, storage and manipulation of models
and images of objects. Computer Graphics today is largely interactive; it is the user who
controls the contents, structure and appearance of objects and of their displayed images
by using input devices, such as keyboard, mouse or touch-sensitive panel on the screen.
Although early applications in engineering and science had to rely on expensive and
cumbersome equipment, advance in computer technology have made interactive graphics
as a practical tool. Computer Graphics is an integral part of all computer user interfaces,
and is indispensable for visualizing two dimensional, three-dimensional, and higher-
dimensional objects: areas as diverse such as education, science, Computer Graphics
started with the display of data on hardcopy plotters and cathode ray tube screens soon
after the introduction of computer themselves. Now it has grown to that extent that it has
included the creation, storage and manipulation of models and images of objects.
Computer Graphics today is largely interactive; it is the user who controls the contents,
structure and appearance of objects and of their displayed images by using input devices,
such as keyboard, mouse or touch-sensitive panel on the screen. Although early
applications in engineering and science had to rely on expensive and cumbersome
equipment, advance in computer technology have made interactive graphics as a practical
tool. Computer Graphics is an integral part of engineering, medicine, commerce, the
military; advertising and entertainment all rely on computer graphics.
Until the early 1980’s, 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 displays popularized the use of bitmap graphics for array of points or also called
as pixels on the screen. Once bitmap graphics became affordable, an explosion of easy-to-
use and inexpensive graphics-based applications soon followed. Graphics-based
interfaces allowed millions f news users to control simple, low cost application programs,
Such as spreadsheets, word processors, and drawing programs. Graphics has its own

Dept. of CSE, JIT. 2022-2023 1


Aquarium Simulation

hardcopy technologies, input technologies and also display technologies. Some of the
hardcopy technologies are printers, pen plotters etc. Some of the display technologies
such direct view storage tube, liquid crystal displays, plasma panels etc. Input
technologies like keyboard, mouse, touch panel, tablets etc.

1.2 Applications of Computer Graphics


Computer graphics is used today in mainly different areas of industry, business,
government, education, entertainment, and most recently, the home. The list of
applications is enormous and is growing rapidly as computers with graphics capabilities
become commodity products. Now let us see some of the applications.
• Computer Aided Design
Computer graphics is used in design process, particularly for engineering and
architectural systems, but almost all products are now computer designed. Generally
referred to as CAD, computer aided design methods are now routinely used in the design
of buildings, automobiles, aircraft, watercraft, spacecraft, computers, textiles, and many
other products.
• Image Processing
In computer graphics, a computer is used to create a picture. Image processing on
the other hand, applies techniques to modify or interpret existing pictures, such as
photographs and TV scans. Two principal applications of image processing are improving
picture quality and machine perception of visual information, as used in robotics.
• Education and Training
Computer generated models of physical, financial and economic systems are often
used as educational aids. Models of physical systems, physiological systems, population
trends, or equipment, can help trainees to understand the operation of the system.
• Entertainment
Computer graphics methods are now commonly used in making motion pictures,
music videos, and television shows.

• Computer Simulation
A computer simulation, a computer model or a computational model is a computer
program, or network of computers, that attempts to simulate an abstract model of
particular system.

Dept. of CSE, JIT. 2022-2023 2


Aquarium Simulation

• Scientific Visualization
It is a branch of science, concerned with the visualization of 3D phenomena, such
as architectural, meteorological, medical, biological systems.
• Virtual Reality
It is a technology which allows a user to interact with a computer-simulated
environment. The simulated environment can be similar to the real world.
• Digital Art
Digital Art most commonly refers to art created on a computer in digital form.

• Web Design
It is the skill of designing presentations of content usually hypertext or
hypermedia that is delivered to an end-user through the World Wide Web, by way of a
web browser.

1.3 History of OpenGL


In the 1980s, developing software that could function with a wide range of
graphics hardware was a real challenge. Software developers wrote custom interfaces and
drivers for each piece of hardware. This was expensive and resulted in much duplication
of effort.
By the early 1990s, Silicon Graphics (SGI) was a leader in 3D graphics for
workstations. Their IRIS GL API was considered the state of the art and became the de
facto industry standard, overshadowing the open standards-based PHIGS. This was
because IRIS GL was considered easier to use, and because it supported immediate mode
rendering. By contrast, PHIGS was considered difficult to use and outdated in terms of
functionality.
SGI's competitors (including Sun Microsystems, Hewlett-Packard and IBM) were
also able to bring to market 3D hardware, supported by extensions made to the PHIGS
standard. This in turn caused SGI market share to weaken as more 3D graphics hardware
suppliers entered the market. In an effort to influence the market, SGI decided to turn the
IrisGL API into an open standard.
SGI considered that the IrisGL API itself wasn't suitable for opening due to
licensing and patent issues. Also, the IrisGL had API functions that were not relevant to
3D graphics. For example, it included a windowing, keyboard and mouse API, in part

Dept. of CSE, JIT. 2022-2023 3


Aquarium Simulation

because it was developed before the X Window System and Sun's News systems were
developed.
In addition, SGI had a large number of software customers; by changing to the
OpenGL API they planned to keep their customers locked onto SGI (and IBM) hardware
for a few years while market support for OpenGL matured. Meanwhile, SGI would
continue to try to maintain their customers tied to SGI hardware by developing the
advanced and proprietary Iris Inventor and Iris Performer programming APIs. As a result,
SGI released the OpenGL standard.
The OpenGL standardized access to hardware, and pushed the development
responsibility of hardware interface programs, sometimes called device drivers, to
hardware manufacturers and delegated windowing functions to the underlying operating
system. With so many different kinds of graphic hardware, getting them all speak the
same language in this way had a remarkable impact by giving software developers a
higher level platform for 3D-software development.
In 1992 SGI led the creation of the OpenGL architectural review board (OpenGL
ARB), the group of companies that would maintain and expand the OpenGL specification
for years to come. OpenGL evolved from (and is very similar in style to) SGI's earlier 3D
interface, IrisGL. One of the restrictions of IrisGL was that it only provided access to
features supported by the underlying hardware. If the graphics hardware did not support a
feature, then the application could not use it. OpenGL overcame this problem by
providing support in software for features unsupported by hardware, allowing
applications to use advanced graphics on relatively low-powered systems.

1.3.1 Common Functions of OpenGL

The glBegin and glEnd functions delimit


glBegin, glEnd the vertices of a primitive or a group of
like primitives.

The glClear function clears buffers to


GlClear
preset values.

GlColor These functions set the current color

The glFlush function forces execution of


GlFlush
OpenGL functions in finite time.

Dept. of CSE, JIT. 2022-2023 4


Aquarium Simulation

The glLoadIdentity function replaces the


GlLoadIdentity
current matrix with the identity matrix.

The glMatrixMode function specifies


GlMatrixMode
which matrix is the current matrix.

GlVertex These functions specify a vertex.

The gluOrtho2D function defines a 2-D


gluOrtho2D
orthographic projection matrix.

1.3.2 Features of OpenGL

OpenGL provides a set of commands to render a three dimensional scene. That


means you provide the data in an OpenGL-useable form and OpenGL will show this data
on the screen (render it). It is developed by many companies and it is free to use.
OpenGL is an API and system-independent interface. An OpenGL-application
will work on every platform, as long as there is an installed implementation.
OpenGL is a collection of several hundred functions that provide access to all of
the features that your graphics hardware has to offer. Internally it acts like a state
machine-a collection of states that tell OpenGL what to do. Using the API you can set
various aspects of this state machine, including current color, blending, lighting effect,
etc.
Because it is system independent, there are no functions to create windows etc.,
but there are helper functions for each platform. A very useful thing is GLUT.

1.4 Advantages of OpenGL

• It can be user-friendly and speed up the user's work.


• It can be more attractive for non-technical people.
• In general, it looks more professional (but this does not mean it is always the best
solution).
• OpenGL is a cross-platform graphics API, which means that the same code can be
used on multiple operating system types with minimal changes.
• OpenGL runs on every computer with graphics output capability and requires no
extra downloads.

Dept. of CSE, JIT. 2022-2023 5


Aquarium Simulation

1.5 Drawbacks of OpenGL

• When it is not properly built, it can be very difficult to work with.

• It generally requires more resources than a non-graphical one.

• It might require the installation of additional software e.g., the “runtime


Environment” in the case of java.
• OpenGL implementations can vary a lot, even certified ones.

• It has traditionally used a confusing state select model where you bind objects or
bind state, which changes which state other functions change. Too bad the old
functions are still available.
• OpenGL which leads to deprecation. For each new OpenGL version, the number
of API functions explodes.

Dept. of CSE, JIT. 2022-2023 6


Aquarium Simulation

CHAPTER 2
LITERATURE SURVEY
2.1 Survey on 3D Shapes:
Content-based shape retrieval techniques can facilitate 3D model resource
reuse, 3D model modeling, object recognition, and 3D content classification. Recently
more and more researchers have attempted to solve the problems of partial retrieval in
the domain of computer graphics, vision, CAD, and multimedia. Unfortunately, in the
literature, there is little comprehensive discussion on the state-of-the-art methods of
partial shape retrieval. In this article we focus on reviewing the partial shape retrieval
methods over the last decade, and help novices to grasp latest developments in this
field. We first give the definition of partial retrieval and discuss its desirable
capabilities. Secondly, we classify the existing methods on partial shape retrieval into
three classes by several criteria, describe the main ideas and techniques for each class,
and detailedly compare their advantages and limits. We also present several relevant 3D
datasets and corresponding evaluation metrics, which are necessary for evaluating
partial retrieval performance. Finally, we discuss possible research directions to address
partial shape retrieval.
2.2 OpenGL
I used OpenGL graphics software to develop my project, OpenGL support on
modern graphics hardware. OpenGL is a cross-platform library for interfacing with
programmable GPUs for the purpose of rendering real-time 3d graphics. Its use is
common in games, CAD, and data visualization applications. It started in the early '90s as
a cross-platform standardization of SGI’s proprietary GL ("Graphics Library") that drove
the graphics hardware in their high-end workstations. A few years
later, GLQuake and 3dfx’s Voodoo graphics accelerators pushed 3d accelerators into the
mainstream, and OpenGL became a standard alongside Microsoft's
proprietary Direct3d library for controlling graphics accelerators in consumer PCs. In
recent years, the Khronos group has taken stewardship of the OpenGL standard, updating
it to support the features of modern programmable GPUs, pushing it into the mobile and
online domains with OpenGL ES and WebGL, and streamlining it in OpenGL 3 by
deprecating the outdated features that cluttered earlier versions of the library.
Another recent development has been the adoption of general purpose GPU
(GPGPU) libraries, including nVidia's CUDA and Khorana’s OpenGL. These libraries

Dept. of CSE, JIT. 2022-2023 7


Aquarium Simulation

implement dialects of C with added data parallelism features, allowing the GPU to be
used for general computation without having to work within the graphics-oriented
framework of OpenGL. However, these GPGPU frameworks don't replace OpenGL;
since their primary purpose is not graphics programming, they only provide access to a
GPU's computation units, ignoring its graphics-specific hardware. They can, however, act
as accessories to OpenGL.We'll be focusing on using OpenGL for graphics tasks. In
addition to OpenGL, we'll be using other helper libraries: GLU (OpenGL Utility) contains
several routines that use lower level OpenGL commands to perform such tasks as setting
up matrices for specific viewing specifications and projection. GLUT (OpenGL Utility
Toolkit), which provides a cross-platform interface between the window system and
OpenGL. For a fallback, Mesa provides an open-source, cross-platform software OpenGL
implementation that works on Windows and almost all UNIX platforms. Mesa is also the
most common OpenGL implementation on Linux, where it also works with the X server
to interface OpenGL with graphics hardware using "direct rendering interface" (DRI)
drivers.

To install GLUT look for the binary packages on their respective sites. MacOS X
comes with GLUT preinstalled. Most Linux distributions have GLUT available through
their package system, though for GLUT, you may need to enable your distribution's
optional "non-free" package repositories, since its license is not technically open
source[3].We use GLUT library for interacting with any screen windowing systems.

Dept. of CSE, JIT. 2022-2023 8


Aquarium Simulation

CHAPTER 3

REQUIREMENT ANALYSIS

3.1 Domain Understanding


The main objective is to develop a suitable OpenGL graphics package to
implement basic computer graphics skills. The aim of the project is to shoot the block
using arrow before the arrow ends using OpenGL.

3.2 Classification of Requirements

3.2.1 User Requirements


Program to demonstrate the shooting the block using arrows, in which designing
and developing this project interesting and a good learning
3.2.1.1 Requirement Collection

Some of the primitives that are implemented in our project are referred by using
the books and websites mentioned in bibliography and others by using built in functions
of OpenGL.
3.2.1.2 User Defined Functions
• void bitmap_output( )
• void counting( )
• void disa( )
• void id ( )
• void disp( )
• void init( )
• void id1( )
• void keys( )
• void demo_menu( )
• void demo( )
• int main(int argc,char** argv)

Dept. of CSE, JIT. 2022-2023 9


Aquarium Simulation

3.2.2 System Requirements

Here we are using header files namely <GL/glut.h>,functions in the OpenGL in


windows are stored in a library usually referred as GL.GLUT uses only GL functions and
also contains code for creating objects and simplifying, viewing, rather than using
different library for each system here we are using readily available library called the
OPENGL UTILITY TOOL KIT(GLUT).

3.2.2.1 Software Requirements


• Operating system: ubuntu

• Programming language-C

• OpenGL

3.2.2.2 Hardware Requirements


• Processor: Pentium processor

• Memory: 32MB RAM.

• Hard Disk:40GB Hard disk

• Interface Device: Mouse, Keyboard, Monitor of Resolution

1024x728

Dept. of CSE, JIT. 2022-2023 10


Aquarium Simulation

CHAPTER 4
IMPLEMENTATION

4.1 Description of Implementation Modules


In this project we have created a 3D Aquarium. We have taken the help of built in
functions present in the header file. To provide functionality to our project we have
written sub functions. These functions provide us the efficient way to design the project.
In this chapter we are describing the functionality of our project using these functions.

4.2 List of Implementation Functions


void draw sphere( ):
This function is used to create an sphere
void draw cube ( ):
This function is used to create an cube.

void draw cone( ):


This function is used to create an cone

void draw torus( ):


This function is used to create an torus

void draw icosohedron( ):


This function is used to create an icosahedron

void myReshape ( ):
This function is used to change the position of an object

void keys ( ):
This function is used to set key to perform desired operations.

Dept. of CSE, JIT. 2022-2023 11


Aquarium Simulation

void mouse ( ):
This function is used to set mouse to perform desired operations

void demo ( ):
This function is sub menu used to display designer names.

4.3 Description of the functions


main ():

The execution of the program starts from the main ().

glutInit ():

Initialises GLUT. The argument from main are passed in and can be used by the

application.

glutInitWindowSize():

Specifies the initial height and width of the window in pixels.

glutCreateWindow():

Creates the window on the display. The string can be used to label the window.

glutDisplayFunc():

Registers the display function that is executed when the window needs to redrawn.

glutMainLoop():

Causes the program to enter an event processing loop.

myinit():

This function is defined to initialize the window parameters.

Dept. of CSE, JIT. 2022-2023 12


Aquarium Simulation

CHAPTER 5
SNAPSHOTS

Fig 5.1 Aquarium OpenGL – Left Movement


.

Dept. of CSE, JIT. 2022-2023 13


Aquarium Simulation

.
Fig 5.2 Aquarium OpenGL - Right Movement

Dept. of CSE, JIT. 2022-2023 14


Aquarium Simulation

CONCLUSION

We have implemented an animation of a two-dimensional Aquarium using OpenGL API


and OpenGL Utility Toolkit (GLUT).

A window with moving fishes, grass, a moving crab, air bubbles, etc., is created using
basic Computer Graphics concepts.

This demonstration is also made interactive by providing a menu in the program. This
animation serves the purpose of computer art.
Other features can be added to achieve,

1. A three-dimensional aquarium
2. Lighting shades can be introduced.
3. Shadow effect.
4. Can provide more options in menu like adding food to the fishes and changing
their speed

Dept. of CSE, JIT. 2022-2023 15


Aquarium Simulation

FUTURE ENHANCEMENT

Sometime the temperature of inside the aquarium or we can say the


temperature of water increases in summers that' s Why fish die because Of
the sudden increase in the temperature.

As there is nothing in the aquarium that could reduce the temperature when
it has increased so a small air cooler or a fan can be used to decrease the
temperature in case the temperature Increases up.

As the aquarium needs 24/7 constant power in order to work so lots Of


power is consumed, GSM mobile also needs a separate constant power.

Lots of power is utilized and it can be a burden on your pocket so in order


to reduce this, solar cells or panels can be used to get the constant power.

so that there Will be no issue Of over billing and burden on your pocket. If
in case Of power failure. the aquarium would not stop its work.

In winter, most of the time, the temperature of the water goes down like
if it is in snowfall area then its temperature would go suddenly down and
the sudden variation in the temperature can kill the fish inside the water.

In our project we have used a bulb because we live in a region where


temperature does not change suddenly. Heater can also used in order to
increase the temperature if it has fallen down.

Dept. of CSE, JIT. 2022-2023 16


Aquarium Simulation

REFERENCES

[1] A.P Godse, Dr. D.A Godse, “Computer Graphics And Visualization”, Technical
Publication Journal, 11 June 2019.

[2] www.youtube.com - Video Reference.

[3] Donald Hearn & Pauline Baker: Computer Graphics with OpenGL Version,3rd / 4th
Edition,
Pearson Education,2011

[4] Edward Angel: Interactive Computer Graphics- A Top Down approach with OpenGL,
5th edition.
Pearson Education, 2008.

[5] M M Raikar & Shreedhara K S Computer Graphics using OpenGL, Cengage publication

[6] https://www.geeksforgeeks.org/getting-started-with-opengl/ - Geeks For Geeks


Reference.

Dept. of CSE, JIT. 2022-2023 17


Aquarium Simulation

APPENDIX

#include <GL/glut.h>

// Fish position and movement variables


GLfloat fishX = -0.5f;
GLfloat fishY = 0.0f;
GLfloat fishSpeed = 0.005f;

// Function to initialize OpenGL


void initGL() {
glClearColor(0.0f, 0.0f, 0.0f, 1.0f); // Set background color to black
}

// Function to draw fish


void drawFish() {
glColor3f(0.0f, 1.0f, 1.0f); // Set fish color to cyan

glBegin(GL_TRIANGLES); // Begin drawing the fish body


glVertex2f(fishX, fishY);
glVertex2f(fishX + 0.1f, fishY - 0.05f);
glVertex2f(fishX + 0.1f, fishY + 0.05f);
glEnd();

glBegin(GL_TRIANGLES); // Begin drawing the fish tail


glVertex2f(fishX - 0.1f, fishY);
glVertex2f(fishX, fishY - 0.1f);
glVertex2f(fishX, fishY + 0.1f);
glEnd();
}

// Function to display the scene


void display() {
glClear(GL_COLOR_BUFFER_BIT); // Clear the color buffer

// Draw the fish


drawFish();

glutSwapBuffers(); // Swap the buffers


}

// Function to update the scene


void update(int value) {
// Update the fish position
fishX += fishSpeed;

// Check if the fish is out of the screen, then reset its position
if (fishX > 1.0f)
Dept. of CSE, JIT. 2022-2023 18
Aquarium Simulation

fishX = -1.0f;

glutPostRedisplay(); // Tell OpenGL to redraw the scene


glutTimerFunc(16, update, 0); // Call update() again after 16 milliseconds
}

int main(int argc, char** argv) {


glutInit(&argc, argv); // Initialize GLUT
glutInitDisplayMode(GLUT_DOUBLE); // Enable double buffering
glutInitWindowSize(800, 600); // Set the window size

glutCreateWindow("Aquarium Project"); // Create the window


glutDisplayFunc(display); // Register display callback function
glutTimerFunc(0, update, 0); // Call update() to start animation

initGL(); // Initialize OpenGL

glutMainLoop(); // Enter the event loop

return 0;
}

Dept. of CSE, JIT. 2022-2023 19

You might also like