1. Page | 1
DYNAMIC SORTING ALGORITHM VISUALIZER USING OPENGL
A Mini Project Report Submitted by
Agnesh Shetty
4NM19CS011
Aditya A Sooda
4NM19CS008
UNDER THE GUIDANCE OF
MR.PUNEETH RP
ASSISTANT PROFESSOR GD-11
Department of Computer Science and Engineering
in partial fulfilment of the requirements for the award of the
Degree of
Bachelor of Engineering in
Computer Science & Engineering
from
Visvesvaraya Technological University,
Belagavi
DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING
N.M.A.M. INSTITUTE OF TECHNOLOGY
(An Autonomous Institution under VTU, Belagavi) (AICTE approved, NBA Accredited, ISO
9001:2008 Certified) NITTE -574 110, Udupi District, KARNATAKA.
(ISO 9001:2015 Certified), Accredited with ‘A’ Grade by NAAC
2. Page | 2
TABLE OF CONTENTS :
1. ABSTRACT AND INTRODUCTION 3-4
2. IMPLEMENTATION 4
3. SYSTEM REQUIREMENT AND SPECIFICATION 4-5
4. SCREENSHOTS 6-10
5. CONCLUSION AND FUTURE WORK 10
8. REFERENCES 11
3. Page | 3
ABSTRACT AND INTRODUCTION
OpenGL was originally developed by Silicon Graphics, Inc. (SGI) as a multi-
purpose, platform-independent graphics API. Since 1992, the development of
OpenGL has been overseen by the OpenGL Architecture Review Board (ARB),
which is made up of major graphics vendors and other industry leaders, currently
consisting of 3DLabs, ATI, Dell, Evans & Sutherland, Hewlett-Packard, IBM,
Intel, Matrox, NVIDIA, SGI, Sun Microsystems, and Silicon Graphics. The Role
of ARB is to establish and maintain the DYNAMIC SORTING ALGORITHM
VISUALIZER OpenGL specifications, which dictates which features must be
included when one is developing an OpenGL distribution. OpenGL is the premier
environment for developing portable, interactive 2D and 3D graphics
applications.
OpenGL intentionally provides only low-level rendering routines, allowing the
programmer a great deal of control and flexibility. The provided routines can
easily be used to build high-level rendering and modeling libraries, and in fact,
the OpenGL Utility Library(GLU), which is included in most OpenGL
distributions, does exactly that. Note that OpenGL is just a graphics library;
Unlike DirectX, it does not include support for sound, input, networking, or
anything else not directly related to graphics.
OpenGL is a collection of several hundred functions providing access to all of
the features offered by our graphics hardware. Internally, it acts as a state
machine –a collection of states that tell OpenGL what to do and that are
changed in a very well-defined manner. Using API, we can set various aspects
of the state machine, including such things as the current color, lighting, blending
4. Page | 4
et al. When rendering, everything drawn is affected by the current settings of the
state machine. At the core of OpenGL is the rendering pipeline. There are many
libraries available that build upon and around OpenGL to add support and
functionality beyond the low-level rendering support that it excels at. Most
important amongst them are GLU, GLUT and SDL.GLU uses only GL functions
but contains code for creating common objects and simplifying viewing. GLUT
provides support for any form of functionality related to windowing, menus or
input. SDL stands for Simple Direct Media Layer is a cross-platform multimedia
library, including support for audio, input, 2D graphics
5. Page | 5
IMPLEMENTATION
4.3 Functions Used :
4.3.1 void initialise (void)
In this function the swapping flag along with global variables that hold
values of X coordinates during swapping are initialized to zero. It also initializes
the array of circles that is obtained from the randomly generated sequence and
place them at equal intervals
4.3.2 void int_str( int rad,char r[] )
This function does the conversion of integer value to string value, so that it
can be passed as parameter to the bitmap output function. It takes rad as the
parameter which is the target number that needs conversion from integer to
string value.
4.3.3 void circle_draw(circle c)
This function draws the circle as per the passed circle structure variable,
which consists of the circle center coordinates along with the radius.
4.3.5 void swap_circles(circle *cc1,circle *cc2)
This function basically swaps the two key circles. Initially the X coordinates
of the two circles are assigned to the 2 global variables and swapping flag is
made TRUE.As long as the first global variable is less than or equal to second
circle X coordinate, decrement the second circle X coordinate by 1 unit.
6. Page | 6
4.3.6 void keyboard (unsigned char key, int x, int y)
This function just checks whether the input character is s or r or 27. Based
on the input if it is 27, exit(0) function is called, else if it is ‘s’ then sorting flag is
initialized to 1 else if ‘r’ then intialise() function is called.
4.3.7 void reshape(int w, int h)
This function is used to reshape the windowwith the new width and height
which is passed as parameters. This function is triggered whenever the
current window is reshape.
7. Page | 7
HARDWARE / SOFTWARE REQUIREMENTS
HARDWARE SPECIFICATION:
➢ Processor: Pentium-3 or Higher
➢ RAM: 64MB or Higher
➢ Hard Disk: 80GB or Higher
SOFTWARE SPECIFICATION:
➢ Windows , 64 bits (PC or Mac computers using Boot Camp)
➢ Any CPU (Intel i5/ i7/ Ryzen 7).
➢ Any GPU that is compatible with OpenGL 3.2. (integrated graphics cards
Intel HD 4000 or above).
➢ For Small projects 4 GB RAM, 10 GB HDD Free Space
➢ For Large projects 16 GB RAM, 40 GB HDD Free Space.
11. Page | 11
CONCLUSION :
The development of mini project has given us a good exposure to openGL by
which we have learnt some of the techniques which helps in the development
of animation and gaming. Hence it is helpful for us to even take this field as our
career too and develop some other features in openGL and provide as token of
contribution to the graphics world
FUTURE SCOPE :
This project has been designed using C++, which works on the windows
platform. The project can be designed using other languages and better
graphical interfaces. The following features could have been incorporated.
• Circular and priority queues can be implemented.
• Different shading effects can be added.
• We can give transparency and fogging to the objects.
12. Page | 12
REFERENCES
1. Stack Overflow for some of errors:
https://stackoverflow.com
2. Glut Installation:
https://www.opengl.org/resources/libraries/glut/glut_downloads.php
3. Setting up Glut Environment:
https://www.youtube.com/watch?v=8p76pJsUP44
4. Stack and Queue operations:
https://www.geeksforgeeks.org/
5. Mingw setup:
https://sourceforge.net/projects/mingw