Final CG
Final CG
Final CG
JnanaSangama, Belgaum-590018
“CATCH ME GAME”
Submitted in Partial fulfillment of the Requirements for VI of the Degree of
SHREYA N S (1CR20CS201)
CERTIFICATE
Certified that the Computer Graphics Mini-project work entitled “CATCH ME GAME” carried out
by Mr T BHARATH KUMAR REDDY, USN 1CR20CS201, Ms. SHREYA NS, USN
1CR20CS181, bonafide students of CMR Institute of Technology, in partial fulfillment for the VI
semester requirements toward the degree of Bachelor of Engineering in Computer Science and
Engineering of the Visveswaraiah Technological University, Belgaum during the year 2022-2023. It
is certified that all corrections/suggestions indicated for Internal Assessment have been incorporated in
the Report deposited in the departmental library. The mini-project report has been approved as it
satisfies the academic requirements in respect of Mini-Project work prescribed for the course,
Computer Graphics and Visualization Laboratory with Mini-project.
External Viva
1.
2.
ii
DECLARATION
We, the students of Computer Science and Engineering, CMR Institute of Technology,
Bangalore declare that the mini-project work entitled "CATCH ME GAME" has been
successfully completed under the guidance of Prof. V N Manju, Assistant Professor and Mr.
Shivraj V B, Assistant Professor Computer Science and Engineering Department, CMR Institute
of technology, Bangalore. This work is submitted in partial fulfillment of the requirements
toward the VI semester Computer Graphics Laboratory with Mini-Project (18CSL67) for the
degree of Bachelor of Engineering in Computer Science and Engineering during the academic
year 2022 - 2023. Further the matter embodied in the project report has not been submitted
previously by anybody toward the requirements of Computer Graphics Laboratory with Mini-
Project (18CSL67) in the VI degree or diploma to any university.
Bengaluru Date:
SHREYA NS (1CR20CS181)
iii
ABSTRACT
The "Catch Me" project develops an immersive game using OpenGL in C. Players aim to catch
moving objects within a time limit. Leveraging OpenGL, the project delivers smooth animations,
responsive controls, and an immersive environment. It showcases the potential of OpenGL for
creating visually captivating gaming experiences. The objective is to engage players through
intuitive gameplay and visually appealing graphics. "Catch Me" highlights OpenGL's power in
creating dynamic and interactive gaming environments, offering an enjoyable and challenging
game.
iv
ACKNOWLEDGEMENT
I take this opportunity to express my sincere gratitude and respect to CMR Institute of
Technology, Bengaluru for providing me a platform to pursue my studies and carry out my final
year project
I have a great pleasure in expressing my deep sense of gratitude to Dr. Sanjay Jain,
Principal, CMRIT, Bangalore, for his constant encouragement.
I would like to thank Dr. Shreekanth M Prabhu, Professor and Head, Department of
Computer Science and Engineering, CMRIT, Bangalore, who has been a constant support and
encouragement throughout the course of this project.
I consider it a privilege and honor to express my sincere gratitude to my guide
Prof. V N Manju, Assistant Professor and Mr. Shivraj V B, Assistant Professor Computer
Science and Engineering Department, for the valuable guidance throughout the tenure of this
review.
I also extend my thanks to all the faculty of Computer Science and Engineering who
directly or indirectly encouraged me.
Finally, I would like to thank my parents and friends for all their moral support they have
given me during the completion of this work.
v
TABLE OF
Page No.
Certificate ii
Declaration iii
Abstract iv
Acknowledgement v
Table of contents vi
List of Figures viii
List of Tables ix
List of Abbreviations x
1 INTRODUCTION 1
1.1 Problem Statement 1
1.2 Objective 1
1.3 Functionalities 2
1.4 OpenGL Package 2
1.5 VS CODE and WSL 3
2 DESIGN 4
2.1 Conceptual Design 4
2.2 Flowchart 5
2.3 Storyboard 5
3 IMPLEMENTATION 10
3. 1 Initialization 10
3.2 Modeling 11
3.3 Viewing 20
3.4 Interactions 21
Keyboard, Mouse
3.5 Animation 22
4 RESULTS AND DISCUSSION 24
4.1 Front Page 24
vi
4.2 Welcome Page 25
4.3 How to play Page 26
4.4 Levels Page 27
4.5 Game Page 28
4.6 Game Over Page 29
5 CONCLUSION 30
REFERENCES 31
APPENDIX A Installation Instructions 32
APPENDIX B OpenGL Functions 34
vii
LIST OF FIGURES
Page No.
Fig 2.1 Game Design 4
Fig 2.2 Flow Chart 5
Fig 2.3 Frame 1 6
Fig 2.4 Frame 2 7
Fig 2.5 Frame 3 7
Fig 2.6 Frame 4 8
Fig 2.7 Frame 5 8
Fig 2.8 Frame 6 9
Fig 4.1 Front page 24
Fig 4.2 Start menu 25
Fig 4.3 How to play screen 26
Fig 4.4 Screen to select level 27
Fig 4.5 Game Screen 28
Fig 4.6 Game Over Screen 29
viii
LIST OF ABBREVIATIONS
GL Graphics Library
GLUT Graphics Library Utility Toolkit
RGB Red Green Blue
2D Two-dimensional
GLU Graphics Library Utility
ix
Catch Me
CHAPTER 1
INTRODUCTION
This project is an interactive game developed using the OpenGL library in C. It utilizes the
GLUT (OpenGL Utility Toolkit) to create a user-friendly interface where players can engage
in gameplay through mouse and keyboard inputs. The game features immersive visuals and
offers various challenges for players to overcome, aiming for high scores. The
implementation demonstrates the power of OpenGL in real-time rendering, showcasing its
potential for creating engaging and visually appealing games. This report provides an
overview of the game's features and discusses possibilities for future enhancements and
broader applications in the gaming industry.
This project focuses on developing an interactive game called "Catch Me" using the OpenGL
library in C. The goal of this project is to create an intuitive and immersive game where
players must catch moving objects within a specified time limit. By harnessing the
capabilities of OpenGL, the project aims to deliver smooth animations, responsive controls,
and an immersive gaming environment. The objective is to provide players with a
challenging and enjoyable game that highlights the potential of OpenGL in creating
interactive and visually captivating gaming experiences.
1.2 Objective
The objective of this project was to utilize the OpenGL library and its functions to build a
game application called "Catch Me." The main focus was on understanding and
implementing various OpenGL functions and techniques to create interactive graphics and
user interfaces. The project aimed to explore the capabilities of OpenGL in real-time
rendering, window management, and handling user input. The objective was not solely to
develop the game itself, but rather to utilize OpenGL as a powerful tool for building dynamic
and visually appealing applications.
Catch Me
1.3 Functionalities
Start Game: This functionality allows the player to initiate the game. It may be
implemented as a button or a menu option that the player can click or select to begin
playing.
Catching Object: The main objective of the game is to catch a moving object on the
screen. The object could be represented as an image or a sprite that the player needs to
click on or interact with using the game controls. The player's ability to accurately catch
the object determines their performance in the game.
Score Tracking: The game keeps track of the player's score as they successfully catch the
moving object. Each time the player catches the object, their score increases. The score is
usually displayed on the screen during gameplay, allowing the player to monitor their
progress and compare it with previous attempts.
Chances: The player is typically given a limited number of chances or attempts to catch
the object successfully. If the player fails to catch the object within the given number of
chances, the game may end or display a "Game Over" message. The concept of chances
adds an element of challenge and encourages players to focus and improve their
performance.
Game Over: When the player exhausts all their chances, the game enters the "Game
Over" state. This state indicates that the player has completed their gameplay session, and
no further interaction is possible. It may display a message to inform the player that the
game is over and provide options to restart the game or return to the main menu.
The OpenGL package plays a pivotal role in the development of our game, providing
essential features that contribute to its success. OpenGL is a powerful and widely-used
graphics library that enables us to create visually stunning and immersive experiences. Its
importance lies in its ability to harness the hardware acceleration of modern GPUs,
optimizing rendering performance and enhancing the overall graphical quality of our game.
With OpenGL, we can utilize advanced rendering techniques such as shading, lighting, and
texture mapping to bring our game world to life. It offers a rich set of features, including
Catch Me
support for 2D and 3D graphics, vertex and fragment shaders, transformation matrices, and
rendering pipelines. These features empower us to create realistic environments, realistic
character animations, and visually appealing special effects. OpenGL provides cross-
platform compatibility, allowing our game to run seamlessly on different operating systems
and devices. Overall, the OpenGL package has been instrumental in enabling us to deliver a
visually captivating and engaging gaming experience to our players.
Visual Studio Code (VS Code) is a widely acclaimed source code editor developed by
Microsoft. It provides a user-friendly interface and a vast extension library, making it a
popular choice among programmers. With its rich features and flexibility, VS Code offers a
customizable workspace that enhances productivity and streamlines the development process.
When combined, these three tools provide a powerful and efficient development
environment. Developers can leverage the user-friendly interface and extensive extension
library of VS Code while utilizing the Linux capabilities and utilities offered by WSL. The C
compiler completes the trio by enabling the execution of C code seamlessly.
Catch Me
CHAPTER 2
DESIGN
The design chapter of this project provides an overview of the Catch Me game's visual and
structural components. It includes a flowchart illustrating the game's logical flow, a
conceptual design showcasing the layout and structure, and a storyboard depicting the step-
by-step functionality of the game. These design elements help us understand how the game
works and what it looks like, making it engaging and enjoyable for players.
The game screen design for the "Catch Me" game features a simple and intuitive layout. The
objective of the game is to click on the moving object to score points. The design emphasizes
a user-friendly interface, making it easy for players to interact with the game and aim for a
high score. The visual elements are engaging and captivating, ensuring an enjoyable gaming
experience for players of all skill levels.
Catch Me
2.2 Flowchart
The game begins with a main menu, offering options to start, access controls, select levels, or
read about the game. Choosing to start takes the player to the gameplay screen, where they
must catch moving objects by clicking. Successful catches increase the score, while misses
reduce chances. If the player runs out of chances, the game over screen appears. The main
menu also provides options to access controls and learn about the game. Exiting the game is
possible through a dedicated option.
2.3 Storyboard
Frame 1:
The user launches the application and sees the home screen with project details.
A prompt on the screen instructs the user to Press “Enter” to Start
Catch Me
Frame 2:
The user presses “Enter” and is taken to the screen where different options are
present.
The user can press the respective number to perform the respective action.
Catch Me
The user presses “2” and a screen where the instructions on how to play the game is
showed
Frame 4:
The user left clicks and is taken to the main screen where they select the level.
The user left clicks and is taken to the main screen where they start the game.
Frame 6:
The user finishes playing the game and is taken to the game over page.
CHAPTER 3
IMPLEMENTATION
The "Catch Me" game was implemented using a C compiler and the GLUT library, with
dependencies such as OpenGL, GLU, and GLUT installed. The code was carefully structured
to handle user input and provide essential game functionalities. Game mechanics, object
movement, were implemented to create an engaging gameplay experience. OpenGL's
graphical rendering capabilities were utilized for visuals, while user interaction was
incorporated for changing screens using keyboard inputs.
3.1 Initialization
main()
This function sets up a window using GLUT for a game called "CATCH ME GAME". It
defines the window size and position, creates the window with the specified title, and
initializes the necessary parameters. Callback functions are registered to handle display,
keyboard, mouse, and window resizing events. The main loop is started, which continuously
checks for events and updates the game. Overall, this code establishes the foundation for the
interactive game window and event handling.
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB);
glutInitWindowSize(1280, 1024);
glutInitWindowPosition(0.0, 0.0);
glutCreateWindow("CATCH ME IF U CAN!!!");
initfun();
glutDisplayFunc(display);
glutKeyboardFunc(keyboard);
Catch Me
glutMouseFunc(mouse);
glutReshapeFunc(reshape);
glutMainLoop();
return 0;
myinit()
This function initializes the OpenGL rendering settings by setting the projection mode to
GL_PROJECTION and loading the identity matrix. It then sets up a 2D orthographic
projection using gluOrtho2D, defining the viewing volume as a rectangle with coordinates (0,
0) as the bottom-left corner and (1280, 1024) as the top-right corner. Finally, it calls the
function mypos() to initialize the position of the objects in the scene.
void initfun()
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
mypos();
3.2 Modelling
Display()
void display(void)
{
glClear(GL_COLOR_BUFFER_BIT);
if (cmrFlag == 0)
{
cmr();
}
Catch Me
{
lev();
}
if (startFlag == 1) // to start game
{
glColor3f(100.0 / 256.0, 0.0, 0.0);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluOrtho2D(0, 1280, 0, 1024);
glColor3f(0.5,0.7,0);
glRectf(0, 0, 1280, 1024);
glColor3f(0, 100.0 / 256.0, 0); // b2
glRectf(70, 70, 860, 680);
glColor3f(0, 0, 0); // b3
glRectf(90, 90, 840, 660);
vs2 = score % 10;
vs1 = score / 10;
glRasterPos2f(100, 800);
for (i = 0; i < sizeof(sco); i++)
glutBitmapCharacter(GLUT_BITMAP_HELVETICA_18, sco[i]);
glRasterPos2f(170, 800);
glutBitmapCharacter(GLUT_BITMAP_HELVETICA_18, vs1 + 48);
glutBitmapCharacter(GLUT_BITMAP_HELVETICA_18, vs2 + 48);
if (hitFlag == 0)
{
glColor3f(1.0, 1.0, 1.0); // object;
drawStar((o.x1 + o.x2)/2.0f, (o.y1 + o.y2) / 2.0f, 20.0, 10);
glFlush();
if (o.x2 <= 840)
moveRight();
if (o.x2 > 840)
randomGenerate();
glFlush();
}
glColor3f(0, 0, 1);
glPointSize(5);
glBegin(GL_POINTS);
glVertex2f(x, y);
glEnd();
if (hitFlag == 1)
Catch Me
{
hitFlag = 0;
glColor4f(1.0, 1.0, 1.0, 1.0);
char b[20] = {"hit..."}, c[20] = {"lost.."};
glRasterPos2f(o.x1, o.y1);
if (messageTrue == 1)
{
score += 10;
for (int i = 0; i < 7; i++)
glutBitmapCharacter(GLUT_BITMAP_HELVETICA_18, b[i]);
glFlush();
}
for (int t = 0; t < 1000; t++)
for (int h = 0; h < 1000; h++)
for (int y = 0; y < 100; y++)
{
}
randomGenerate();
}
}
glFlush();
}
The display function is responsible for rendering the game's graphics on the screen. It begins
by clearing the color buffer, ensuring a clean canvas for drawing. The function then checks
various flags to determine the current state of the game. If the cmrFlag is not set, the cmr
function is called to display the camera view. If the startFlag is set, the game screen is
rendered with different colored rectangles, score display, and the moving star object. The
star's position is updated by calling the moveRight and randomGenerate functions based on
its current coordinates. If the hitFlag is set, the appropriate message is displayed, the score is
updated, and a new star is randomly generated. The function also handles displaying the
controls and about windows based on the corresponding flags. Overall, the display function
ensures the proper rendering of game elements based on the game's state and user interaction.
Primitives:
glClear(GL_COLOR_BUFFER_BIT): Clears the color buffer to prepare for drawing the next
frame.
Catch Me
glRectf(x1, y1, x2, y2): Draws a filled rectangle with the specified coordinates.
Algorithms:
gluOrtho2D(0, 1280, 0, 1024): Sets up a 2D orthographic projection matrix to define the
viewing volume.
glRasterPos2f(x, y): Sets the current raster position for subsequent bitmap character
rendering.
glutBitmapCharacter(font, character): Renders a bitmap character from the specified font at
the current raster position.
Startmenu()
void startmenu()
{
if (dirFlag == 1)
{
dirFlag = 0;
upFlag = 0;
yy1 -= 100;
yy2 -= 100;
glColor3f(0.6, 0.7, 0.8);
glRasterPos2f(300, 900);
for (w = 0; w < sizeof(wel); w++)
glutBitmapCharacter(GLUT_BITMAP_HELVETICA_18, wel[w]);
glRasterPos2f(250, 850);
for (w = 0; w < sizeof(max); w++)
glutBitmapCharacter(GLUT_BITMAP_HELVETICA_18, max[w]);
glColor3f(0.5, 0.1, 0.7);
glRasterPos2f(200, 700);
for (w = 0; w < sizeof(start); w++)
glutBitmapCharacter(GLUT_BITMAP_HELVETICA_18, start[w]);
glColor3f(0.7, 0.8, 0.9);
glRasterPos2f(200, 600);
for (w = 0; w < sizeof(controls); w++)
glutBitmapCharacter(GLUT_BITMAP_HELVETICA_18, controls[w]);
glColor3f(0.2, 0.5, 0.7);
glRasterPos2f(200, 500);
for (w = 0; w < sizeof(levels); w++)
glutBitmapCharacter(GLUT_BITMAP_HELVETICA_18, levels[w]);
glColor3f(1.0, 0.8, 0.3);
glRasterPos2f(200, 400);
Catch Me
The startmenu function handles the display of the start menu in the game. It checks the
values of dirFlag and upFlag to determine if any menu animation is required. If dirFlag is set
to 1, the menu items are shifted downwards by reducing the y-coordinates. On the other
hand, if upFlag is set to 1, the menu items are shifted upwards by increasing the y-
coordinates. The appropriate colors and positions are set using glColor3f and glRasterPos2f.
Catch Me
Text is then rendered using glutBitmapCharacter to display the menu options. Finally,
glFlush ensures that the drawing commands are executed.
Controls1()
The controls1 function is responsible for displaying the controls window in the game. It sets
the appropriate colors and draws rectangles to create the window background. Text is then
rendered using glRasterPos2f and glutBitmapCharacter functions to provide information
about the game controls. After displaying the controls, controlsFlag is reset to indicate that
Catch Me
the controls window is no longer active. Finally, glFlush ensures that all the drawing
commands are executed.
Lev()
void lev()
{
glColor3f(0.5, 0.5, 0.5);
glRectf(0, 0, 1280, 1024);
glColor3f(0, 0, 0);
glRasterPos2f(300, 800);
for (w = 0; w < sizeof(lev1); w++)
glutBitmapCharacter(GLUT_BITMAP_HELVETICA_18, lev1[w]);
glRasterPos2f(300, 700);
for (w = 0; w < sizeof(lev2); w++)
glutBitmapCharacter(GLUT_BITMAP_HELVETICA_18, lev2[w]);
glRasterPos2f(300, 600);
for (w = 0; w < sizeof(lev3); w++)
glutBitmapCharacter(GLUT_BITMAP_HELVETICA_18, lev3[w]);
glRasterPos2f(300, 400);
for (w = 0; w < sizeof(lev5); w++)
glutBitmapCharacter(GLUT_BITMAP_HELVETICA_18, lev5[w]);
glRasterPos2f(300, 500);
for (w = 0; w < sizeof(lev4); w++)
glutBitmapCharacter(GLUT_BITMAP_HELVETICA_18, lev4[w]);
levFlag = 0;
glFlush();
}
The lev function is responsible for displaying the level selection window in the game. It sets
the appropriate colors and draws a rectangle to create the window background. Text is then
rendered using glRasterPos2f and glutBitmapCharacter functions to provide information
about the available levels. After displaying the level options, levFlag is reset to indicate that
the level selection window is no longer active. Finally, glFlush ensures that all the drawing
commands are executed.
Catch Me
cmr()
void cmr()
{
glColor3f(0, 0, 0);
glRectf(0, 0, 1280, 1024);
glFlush();
}
The cmr() function utilizes OpenGL commands to display concise information about the
project creators and their guides. It sets the background color, positions and renders text in
various colors, and draws a horizontal line. The function provides details about the
individuals involved in the project, facilitating recognition and acknowledgement of their
contributions.
3.3 Viewing
We have used a 2D orthographic projection for the game. It defines a viewing volume that
spans from coordinates (0, 0) in the bottom-left corner to (1280, 1024) in the top-right corner
of the window. This projection ensures that objects maintain a consistent size regardless of
Catch Me
their position in the game world, making it suitable for 2D rendering without perspective
distortion.
3.4 Interactions
Mouse()
This function is a callback function triggered when a mouse button is pressed or released. It
updates the current mouse coordinates (mx and my) and adjusts the y-coordinate to match the
OpenGL window coordinates. The code then checks if the mouse is within the bounds of a
specific object (o). If the condition is met, it sets a flag (hitFlag) and displays a message
(messageTrue). Finally, it requests a redisplay of the scene using glutPostRedisplay() to
update the screen and reflect the changes caused by the mouse action.
Keyboard()
void keyboard(unsigned char key, int mx, int my)
{
if (key == '1')
startFlag = 1;
if (key == '2')
controlsFlag = 1;
if (key == '4')
aboutFlag = 1;
if (key == '3')
Catch Me
levFlag = 1;
if (key == 'a')
level1 = 1;
if (key ==
'b') level2 =
1;
if (key ==
'c') level3
= 1;
if (key == 13)
cmrFlag = 1;
glutPostRedisplay();
}
The keyboard function is a callback function that responds to keyboard input in the game.
When a key is pressed, it checks the value of key to determine which key was pressed. Based
on the key pressed, it updates different flags and variables in the game. For example, pressing
'1' sets the startFlag to 1, indicating that the game should start. Pressing 'a', 'b', or 'c' sets the
corresponding level variables (level1, level2, level3) to 1, indicating the selection of different
game levels. Pressing 'Enter' sets the cmrFlag to 1, triggering a specific action related to the
camera. Finally, it calls glutPostRedisplay() to notify the system that the display needs to be
redrawn to reflect the changes caused by the keyboard input.
3.5 Animation
moveRight()
void moveRight()
{
if (level1 == 0 && level2 == 0 && level3 == 0)
v = 5;
if (level1 == 1)
v = 5;
else if (level2 == 1)
v = 10;
else if (level3 == 1)
v = 15;
o.x1 = o.x1 + v;
o.y1 = o.y1;
Catch Me
This function is responsible for moving the star towards the right direction. It updates the
star's position by incrementing its x-coordinate, allowing it to move horizontally across the
screen.
Catch Me
CHAPTER
4
RESULTS AND DISCUSSION
This section presents a collection of screenshots showcasing various screens of the game,
accompanied by descriptive explanations. This chapter serves to visually illustrate the
different aspects and features of the game, providing readers with a comprehensive
understanding of its graphical interface and gameplay elements. The screenshots and
descriptions contribute to the discussion by highlighting the visual aesthetics, user interface
design, and overall gameplay experience, fostering a deeper analysis and evaluation of the
game's performance and effectiveness.
The front page image showcases the introductory section of the application, featuring
relevant information such as the institution's name, department, project title, and the names
of the creators and their guides.
Catch Me
This screen, referred to as the start menu, displays a graphical user interface with various
options. It presents a menu layout featuring buttons for starting the game, accessing controls,
selecting levels, and obtaining information about the game. The menu design utilizes
different colors and font styles to enhance visual appeal and improve user experience. The
screen can be navigated using directional flags, allowing users to move up and down the
menu options.
Catch Me
This screen is a graphical interface that provides instructions and information about the game
controls. It features a visually appealing layout with colored rectangles as the background.
The page displays textual content explaining how to navigate and interact with the game. It
provides step-by-step instructions and guidelines to help users understand the controls and
gameplay mechanics. The information is presented in a clear and organized manner, making
it easy for players to learn how to play the game.
Catch Me
This screen is a visually simple interface that allows players to choose different levels of the
game. The page displays a list of available levels along with their corresponding information
or names. Users can easily navigate through the options and select the desired level to play.
The textual content is presented in a clear and readable format, making it convenient for
players to make their selection.
Catch Me
This screen is the main interface where the gameplay takes place. The background is colored,
providing visual contrast and separating the game area from the rest of the screen. The game
area is represented by a rectangular shape, filled with a different color, serving as the playing
field. The player's score is displayed at the top of the screen. The game involves interacting
with a moving object, represented by a star, using a point as a cursor. The objective is to hit
the moving object accurately. If the player successfully hits the object, they earn points, and a
"hit" message is displayed briefly. If the player misses the object, a "lost" message is
displayed, and the object is regenerated in a random position.
Catch Me
The "Game Over Screen" is displayed when the game ends. The screen is filled with a
specific color, providing a distinctive background. The text "Game Over" is prominently
displayed at a specific position on the screen. Depending on the player's score, different
messages are shown. If the player's score is 100, a congratulatory message is displayed along
with the score. Otherwise, the player's score is shown, and if the score is 0, a message of
"hard luck" is displayed. The screen remains visible for a short duration before exiting the
game.
Catch Me
CHAPTER 5
CONCLUSION
One of the main challenges we faced during the project was managing the graphical
rendering and ensuring smooth gameplay. We had to optimize the code and balance
performance with visual appeal, constantly considering the best approach. Additionally,
implementing collision detection and scoring mechanisms presented some complexities that
required careful attention.
Overall, this project has allowed us to develop a game using OpenGL, learn valuable skills in
graphics programming, and overcome challenges in game development. With further
development, the game can be expanded with additional functionalities and features to make
it even more engaging and enjoyable for players.
REFERENCES
[1] Angel, Edward. Interactive Computer Graphics: A top-down approach with OpenGL.
Addison-Wesley Longman Publishing Co., Inc., 1996.
[2] Hearn, D., Baker, M. P., & Baker, M. P. (2004). Computer graphics with
OpenGL (Vol. 3). Upper Saddle River, NJ:: Pearson Prentice Hall.
[3] Set up Visual Studio Code
https://code.visualstudio.com/learn/get-started/basics
Appendix A
Installation
1. Install WSL2
Ensure that you have Windows 10 version 2004 or later with WSL2 support. You can
check this by running wsl -l -v in the Windows Command Prompt or PowerShell.
Enable the Windows Subsystem for Linux (WSL) feature. Open PowerShell as
Administrator and run the following command:
wsl –install
Appendix B
OpenGL Functions
void glOrtho(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top,
GLdouble nearVal, GLdouble farVal)
void glBegin(GLenum mode)
void glEnd(void)
void glVertex2f(GLfloat x, GLfloat y)
void glClear(GLbitfield mask)
void glColor3f(GLfloat red, GLfloat green, GLfloat blue)
void glRectf(GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2)
void glRasterPos2f(GLfloat x, GLfloat y)
void glutBitmapCharacter(void *font, int character)
void glFlush(void)
void gluOrtho2D(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top)
void glMatrixMode(GLenum mode)
void glLoadIdentity(void)
void glPointSize(GLfloat size)
void glBegin(GLenum mode)
void glEnd(void)
void glVertex2f(GLfloat x, GLfloat y)
void glutPostRedisplay(void)