2DGame Report
2DGame Report
2DGame Report
1. INTRODUCTION
Due to close relationships between the input devices and the display, the
handling of such devices is included in the study of computer graphics. The
advantages of the interactive graphics are many in number. Graphics provides one of
the most natural means of communicating with a computer, since our highly
developed 2D and 3D patter-recognition abilities allow us to perceive and process
data rapidly and efficiently. In many design, implementation, and construction
processes today, the information pictures can give is virtually indispensable. Scientific
visualization became an important field in the 1980s when the scientists and engineers
realized that they could not interpret the prodigious quantities of data produced in
supercomputer runs without summarizing the data and highlighting trends and
phenomena in various kinds of graphical representations.
polygons. Higher level objects like cubes are implemented as six four-sided
polygons.
• OpenGL supports features like 3-dimensions, lighting, anti-aliasing, shadows,
textures, depth effects, etc.
• It is system-independent. It does not assume anything about hardware or
operating system and is only concerned with efficiently rendering
mathematically described scenes. As a result, it does not provide any
windowing capabilities.
• It is a state machine. At any moment during the execution of a program there
is a current model transformation
• It is a rendering pipeline. The rendering pipeline consists of the following
steps:
o Defines objects mathematically.
o Arranges objects in space relative to a viewpoint.
o Calculates the color of the objects.
o Rasterizes the objects.
2. SYSTEM SPECIFICATION
GL/glut.h:
We use a readily available library called the OpenGL Utility Toolkit (GLUT),
which provides the minimum functionality that should be expected in any modern
windowing system.
The application program uses only GLUT functions and can be recompiled
with the GLUT library for other window system. OpenGL makes a heavy use of
macros to increase code readability and avoid the use of magic numbers. In most
implementation, one of the include lines
3.1 Overview:
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.
By pressing P and R we can pause and restart the game. By pressing N we can move
from the current window to next window.
3.3 Purpose:
The aim of this project is to develop a graphics package which supports basic
operations which include building a 2D GAME using Open GL. The package must
also has a user-friendly interface. The objective of developing this model was to
design and apply the skills we learnt in class.
3.4 Scope:
It provides most of the features that a graphics model should have. It is developed in
C language. It has been implemented on LINUX platform. The graphics package
designed here provides an interface for the users for playing 2D GAME using bat and
ball.
4. IMPLEMENTATION
• void glutSwapBuffers();
Swaps the front and back buffers.
• void glLoadIdentity( );
Sets the current transformation matrix to identity matrix.
• void glutMainLoop();
Causes the program to enter an event-processing loop.
• void createMenu(void);
This function is used to create menus which are used as options in program.
glutKeyboardFunc (mykeys);
glutDisplayFunc (display);
glutReshapeFunc (reshape);
glutMouseFunc (mouse);
• void Timer(int v)
Using this function in the program the ball movements towards left, right, top, bottom
is achieved.
5. TESTING
Testing process started with the testing of individual program units such as
functions or objects. These were then integrated into sub-systems and systems, and
interactions of these units were tested.
Testing involves verification and validation.
Validation: “Are we building right product?”
Verification: “Are we building the product right?”
The ultimate goal of the verification and validation process is to establish
confidence that the software system is ‘fit for purpose’. The level of required
confidence depends on the system’s purpose, the expectations of the system users and
the current marketing environment for the system.
With the verification and validation process, there are two complementary
approaches to the system checking and analysis:
Software inspections or peer reviews analyses and check system
representations such as the requirements document, design diagrams, and the program
source code. Software testing involves running an implementation of the software
with test data.
6. SNAPSHOTS
8. BIBLIOGRAPHY
1. EDWARD ANGEL
Interactive Computer Graphics, 5th edition, universities of New Mexico.