Darshancg
Darshancg
“JnanaSangama”, Belgaum-590018
Dr. Krishna A N
Professor & Head
Dept. of CSE, SJBIT
Marks
Sl No. Assignment No. Total Marks
Obtained
1 Assignment 1 10
2 Assignment 2 10
Total Marks:
CHAPTER 1
Introduction to OpenGL
OpenGL is the most widely adopted 2D and 3D graphics API in the industry, bringing
thousands of applications to a wide variety of computer platforms. It is designed to be a low-level
API, focusing on the rendering of 2D and 3D graphics, and does not include commands for
windowing tasks or obtaining user input. OpenGL is responsible for rendering 2D and 3D graphics,
but it does not provide high-level commands for describing models of three-dimensional objects.
Instead, it requires the programmer to build up their desired model from a small set of geometric
primitives such as points, lines, and polygons [1].
OpenGL operates as a state machine, where the state of the system is modified by a
sequence of commands. The state variables in OpenGL are used to track the current settings and
configurations of the graphics pipeline. Commands are provided for querying, enabling, and
disabling states, allowing for precise control over the rendering process. Understanding the
rendering pipeline is crucial for optimizing graphics performance and creating complex graphics
effects [2].
CHAPTER 2
Introduction to Project
In the project “ 2D GAME”, the project is programmed using c++. Oops concepts are explored
and the project involves the Bat and Ball on which basis game is built. In this game there will be two
players . PC will be the First player and USER will be the second player. This program contains Functions
to drag the ball, draw the bat etc.
This project includes the multiple windows, menus and submenus using which color of the bat & ball,
screen color, ball size will be changed. These all actions are assigned to keyboard and mouse.
User-interface is provided by means of both Keyboard and Mouse. By using arrow keys bat can be moved.
Mouse interaction is achieved by means of a menu which is operational only with the “right mouse
button” through which bat , ball , screen color changing , speed settings are enabled.
Our game is a simple ball with bat game. The bat will be moved according to the movement of the mouse.
And the ball will move randomly in the created window. When the ball hits the right, left, or top wall –
we will refer to the window border as a wall - it will return back. When it hits the bottom wall it will not
only return back but it will increase the score of the computer, but if the player can hold it by the bat, his
score will be increased.
CHAPTER 3
3.2 Hardware:
CHAPTER 4
System Design
4.1 Components:
• Player: Controlled by user input, with movement, animation, and collision detection.
• Enemies: Automated entities with AI for movement and interaction.
• Collectibles/Power-ups: Items to be collected by the player.
• Backgrounds/Layers: Parallax scrolling for depth effect.
• Keyboard and Mouse: Capture user input for player control and interaction.
• Game Controllers: Optionally, support for gamepads/joysticks for input.
4.1.4 Audio:
4.2.2 Implementation:
4.2.4 Updates:
• Add visual effects (e.g., particle systems, screen shakes).
• Fine-tune gameplay parameters (e.g., movement speed, enemy behaviors).
• Implement game transitions (e.g., level completion, game over).
• Enhance UI/UX for clarity and usability.
• keyboard() handles key presses to reset the game (using the 'r' key).
4.4.1 Initialization:
The main () function initializes GLUT, sets up the window, and registers callback function
(display (), update(), mouse(), motion(), keyboard()).
Calls init () to set up the initial state.
CHAPTER 5
Implementation
➢ glutCreateWindow() : this opens the OPENGL window and displays the title
at top of the window
➢ glTranslatef() : used to translate or move the rotation centre from one point to
another in three dimensions
CHAPTER 6
Results
6.1 Snapshots:
Conclusion:
The Project was started with modest aim with no prior experience in any programming projects as
this, but ended up in learning many things, fine tuning the programming skills and getting into the
real world of software development with an exposure to corporate environment .During the
development of any software of significant utility , we are forced with the tradeoff between speed
of execution and amount of memory consumed . This is simple graphics project . It has an open
source and no security features has been included . The user is free to alter the code for feature
enhancement . Checking and verification of all possible types of the functions are taken care . Care
was taken to avoid bugs . Bugs may be reported to creator as the need .
Further this project can be enhanced by adding few more options i.e menus in game. Using this
we can design a 3D game which contains cube instead of single window and multiple number of
balls which are randomly moving and all faces of cube is considered as wall .
Future Scope:
References
[1] https://www.opengl.org/documentation/
[2] https://www.opengl.org/documentation/red_book/
[3] https://www.opengl.org/resources/libraries/glut/
[4] https://www.crcpress.com/Real-Time-Rendering/Akenine-Moller-Haines-
Hoffman/p/book/9781138627000
[5] https://visualstudio.microsoft.com/downloads/
[6] https://learn.microsoft.com/en-us/visualstudio/releases/2022/system-requirements