SlideShare une entreprise Scribd logo
1  sur  20
Télécharger pour lire hors ligne
Arkanoid Game

    Computer Graphics

JOGL Implementation Project
    Raffaele De Amicis, Giuseppe Conti




       Submitted By
   Anuradha Jambunathan
     Matricola: 128682
       12 - 02 - 2008
Table of Contents
1           Introduction...........................................................................................3
    1.1     OpenGL .................................................................................................3
    1.2     JOGL......................................................................................................4
    1.3    Open GL Commands ............................................................................5
      1.3.1 Color Manipulation Commands .......................................................5
      1.3.2 Drawing and Matrix Manipulation Commands ...............................5
      1.3.3 Stack Manipulation Commands .......................................................6
      1.3.4 Texture manipulation Commands ...................................................6
      1.3.5 Viewing manipulation commands ...................................................7

2           Requirements........................................................................................8

3           Design Analysis ..................................................................................10
    3.1     Classes and Methods .........................................................................10
    3.2     Class Diagram.....................................................................................15

4           Implementation ...................................................................................16
    4.1     Collision detection Algorithm............................................................16
    4.2     Additional Features ............................................................................17
    4.3     Software Details..................................................................................18

5           Conclusion & Future Work ................................................................18

6           References ..........................................................................................19

7           Appendix .............................................................................................20
    7.1     Game Screenshot ...............................................................................20
1 Introduction
       Computer games are considered to be the fast growing and more
interesting field of study today. The interactive entertainment field makes use of
the latest computer technologies and helps for the development of research in
areas such as computer simulation, computer aided designing, virtual reality,
artificial intelligence etc. Development of games is considered to be the more
creative way of software development. Game development requires more of
innovative thinking and ideas to work in the imaginary world.
       OpenGL (Open Graphics Library) is a standard specification which is used
to write software application to create 2D and 3D graphics. Open GL is a platform
independent API which makes it easy to use and has good performance
capability. The Open GL utility library (GLU) provides sophisticated modeling
features which are not available in standard Open GL.
       Java Open GL (JOGL) is a library that’s helps to use the OpenGL in java
programming language. It is also easy to program using JOGL with a good
programming knowledge of JAVA. This project is developed using JOGL.
       This project is aimed at developing an Arkanoid game also called as Ball
and Bricks game using JOGL. All the inbuilt methods available in Open GL are
not used and the own methods are implemented to demonstrate the same
functionality.
       This game is made very simple and interactive for use. The UI designed
makes use of all the features of Open GL learnt during the course. The game is
designed as a 2D game area embedded in a 3D world to give a feel of playing in
3D world to the user.



1.1 OpenGL
       OpenGL was developed by Silicon Graphics Inc. (SGI) in 1992. It is a
software interface to graphics hardware. It is a standard specification which
contains of nearly 150 commands that is used to specify the primitives or objects
and create operations that are required to produce 3D applications. It is a
hardware independent interface that can be implemented in any hardware
platform.
        It has got two main advantages, first to hide the complexity of the
interacting hardware device by providing a single uniform API for the programmer
and secondly it is easy to use and provides a good performance and also focus
on rendering.
        Open GL does not have high level complicated commands for creating 3D
objects, whereas these features are provided by the library built top on Open GL.
Open GL utility library (GLU) is used to create complex objects like sphere,
cylinder , quadric surfaces etc.
        GL utility library (GLU) contains routines which make use of the Open GL
low level commands for setting up matrices for viewing and specific
transformations etc. Every window system has a library that extends the
functionality of the window system to support the OpenGL rendering.
        GLUT which is the OpenGL utility toolkit is a library which is used to
simplify the interaction with the windowing system. GLUT is used to write Open
GL programs without taking care about the windowing system. GLUT provides
following simplified functionalities like opening a window, getting input from
mouse or keyboard, menus etc.

1.2 JOGL

        Java OpenGL (JOGL) is a library that helps to use Open GL in java
programming language. It provides full access to Open GL 2.0 and also it
integrates with swing and AWT.
        It is used to create hardware supported 3D graphics to the applications
that are written in Java. It is easy because anyone who has a good knowledge in
java can do the program very easily. In this project, the game is developed using
JOGL.
1.3 Open GL Commands
       There are nearly 150 commands present in Open GL. In this section we
discuss some of the important commands and the commands which are used in
this project

1.3.1 Color Manipulation Commands

glClearColor – This specifies the clear values for the color buffers. Values given
are between the range 0 and 1.


glColor3f – This specifies the red, green and blue color float explicitly and sets
the current alpha intensity value to 1.

1.3.2 Drawing and Matrix Manipulation Commands

glBegin, glEnd – This command is used as a delimiter of the vertices used to
draw a primitive. All the vertices used for drawing a primitive are used inside this
enclosing block.


glVertex – This command is used within the glBegin and glEnd block to specify
the points used to draw the desired primitive. The current color, textures are
associated with the vertex when this command is called.


glLoadIdentity – This command is used to load the identity matrix by replacing
the current matrix in the stack.


glMatrixMode – This command specifies which matrix is the currently used one.
The mode can take three values which can be one of the following:

                      a. GL_MODELVIEW - This is used to position the view in the scene.
                         Used for 3D modeling, all the operations done are applied on the
                         modelview matrix stack.
b. GL_PROJECTION – This defines the way the 3D scene is
                            projected as 2D scene. All the operations done are applied on the
                            projection matrix stack.
                     c. GL_TEXTURE – Applies all the operations on the texture matrix
                            stack.


glTranslate – This command is used to translate the current position with the
given x, y and z values. The current matrix which is specified previously in the
glMatrixMode is multiplied by the translation matrix. The multiplied result replaces
the current matrix value.


glRotate – This command is used to rotate for the given rotation angle around
the vector x, y and z. Similarly the current matrix which is specified previously in
the glMatrixMode is multiplied by the rotation matrix. The multiplied result
replaces the current matrix value.


glScale - This command is used to produce a desired scaling factor along the x,
y and z axes. Similarly the current matrix which is specified previously in the
glMatrixMode is multiplied by the scaling matrix. The multiplied result replaces
the current matrix value.


1.3.3 Stack Manipulation Commands

glPushMatrix, glPopMatrix – This command is used to push and pop the
current matrix stack used.

1.3.4 Texture manipulation Commands

glGenTextures - This command is used to generate texture names with takes as
parameter the number of texture to be generated and the array where the
generated texture names are stored.
glBindTexture – This command is used to bind the name of the texture to the
texture target.


glTexParameteri – This command assigns the values to the texture parameter
specified. The target defines the corresponding texture target.


glTexImage2D – This command is used to specify a 2D texture image


glTexCoord – This command is used to specify the texture coordinates in 1D,
2D or 3D. The glTextCoord2d used in this project specifies the S-Tangent and T-
tangent vales of the texture used.


1.3.5 Viewing manipulation commands

glViewport – This command is used to set the view port area by specifying the
lower left corner pixel points of the rectangle, height and width of the rectangle
area.


gluOrtho2D – This command specifies the 2D projection matrix and sets up the
2D orthographic viewing region. It specifies the left and right vertical clipping
planes and bottom, top horizontal clipping planes.


gluPerspective – This command specifies the view coordinate system into world
coordinate system. The aspect ratio should match the view port aspect ratio in
order to see the image without any distortion.
2 Requirements
          This project is aimed at developing an interactive “Arkanoid” game also
called as “Ball and Bricks” game using JOGL. The game interface should be
easy to use by the user and provide a good visual presentation for attracting the
player.
          Let us look into the requirements for creating this Arkanoid game

          1. The Game developed should be an interactive Arkanoid play.
          2. The Arkanoid game developed should have a paddle which helps to
             hold the ball.
          3. The ball should bounce inside the play area and target to break the
             bricks.
          4. The ball is allowed only to move inside the play area boundary.
          5. Once there is a collision of the ball with the bricks or the play area
             boundary or the paddle the ball has to bounce in the corresponding
             direction.
          6. The Direction of the ball motion must be calculated based on the
             direction of the collision.
          7. Once the ball hits the target bricks, then the brick should be broken or
             destroyed.
          8. The game score should be shown based on the number of bricks
             destroyed by the user.
          9. Each time the ball is dropped or missed then the lives should be
             decreased.
          10. The maximum number of lives for the player is given as three.
          11. The game should be over if all the lives are gone and still there are
             some bricks which are not broken.
          12. Player should win the game if he breaks all the bricks before all the
             lives are finished.
          13. Bonus should be given to the player is the ball hits the selected brick
             marked in a different color.
14. The Bonus brick should marked in blue color.
      15. When the bonus brick is hit by the ball, five bricks adjacent to the
         bonus brick should be broken and the score should be increased.
      16. The Arkanoid play area should a 2D plane embedded in a 3D
         environment.
      17. The Game should be played using keyboard control or using mouse as
         desired by the player.
      18. The User interface should be made more attractive by giving texture
         for play area, ball and bricks.
      19. There should a combined swing frame which displays the current
         score, lives to the user.
      20. There should be also some extra features available to change the
         background color, rotate the play board after the game etc.
      21. The inbuilt Open GL functions like glTranslate; glRotate etc should not
         be used. Own matrix operations should be implemented to
         demonstrate the above functionalities.
      22. The Game should be developed using JOGL.


The game was developed based on the above requirements.
3 Design Analysis
         In this section, we discuss the object-oriented approach followed in the
designing of the game, the actual algorithm used to detect collisions,
assumptions and limitations of the game. This game is developed using JOGL
and uses Java Swing technology for presentation.

3.1 Classes and Methods

         The various classes and important methods used are discussed below.




Class – BouncingApplication
This Class contains the main method. Used for startup of the application. This
class contains all the swing components used for this game. The Registration of
the GLEventListener, KeyListener, and MousemotionListener is done here.
Methods                                  Description
main()                                   The main method is invoked by JVM and
                                         it   instantiates    the     class    (Bouncing
                                         Application)     and       opens     the   frame
                                         (JFrame)       and     registers     the   event
                                         handlers. Creates the canvas for the
                                         renderer display and creates the visual
                                         components.


Class – BouncingBallRenderer
This class extends the GLEventListener, ActionListener and MenuListener. This
contains all the graphics related methods and the key algorithm used for collision
detection and displaying the graphics.
Methods                                  Description
init(GLAutoDrawable gLDrawable)          This method is called the first time and it
initializes   the   graphics   display.   The
                                          matrixes are set to identity and all
                                          textures are created here. This method
                                          calls the display
display(GLAutoDrawable                    This method is used for rendering the
gLDrawable)
                                          graphics. This method is called repeated
                                          by using an Animator. This methods
                                          contains all the important methods for
                                          displaying the game and contains the
                                          algorithm used
reshape(GLAutoDrawable                    This method is called when the window is
gLDrawable,   int   x,   int   y,   int
                                          resized
width, int height)
drawBoundaryBox(GL gl)                    This method is used to draw the outer
                                          boundary box of the play area.
drawBricks(GL gl)                         This method is used to draw or display
                                          the target bricks to break.
checkGameOver()                           This method is used to check if the game
                                          is over. It can be the case if all the bricks
                                          are broken or all the lives are finished.
updatePlatePosition(GL gl)                This method is called to track the new
                                          position of the plate moved by the player
                                          and draw the new position. This is
                                          accomplished        by    performing        the
                                          operations on the Plate Matrix Stack
drawBallOnPlate(GL gl)                    This method is used to draw the ball on
                                          the plate
updateBallPosition()                      This method is used to calculate the
                                          movement of the ball. It increments the x
                                          and y value for the movement based on
                                          the direction of the bouncing ball. This
method contains the logic for the collision
                                    detection.
calculateStackResult(boolean        This method is used to calculate the
plate)
                                    result of the Plate Matrix stack and Ball
                                    Matrix stack based on the Boolean value
                                    passed. True for Plate and False for ball.
breakBrick(int i)                   This method is used to break the brick.
                                    The parameter value identifies which
                                    brick to break.
moveCamera(double xvalue, double    This method is used to perform the matrix
yvalue,double zvalue,boolean
                                    operation. The push operation of the
isPlate)
                                    corresponding matrix stack is done here
                                    whenever there is a movement in the ball
                                    or the plate.
keyPadMovement()                    This method contains the movement for
                                    the key press
mouseMovement()                     This method contains the movement
                                    update when mouse control is used.
actionPerformed(ActionEvent e)      This method is invoked when a button
                                    click is done. When the play button, color
                                    button is clicked etc.
menuSelected(MenuEvent arg0)        This method checks the menu (Game
                                    control) selected by the user.



Class – KeyNavigator
This class extends KeyAdapter class. This class is invoked whenever a key is
pressed by the user.
Methods                             Description
keyPressed(KeyEvent e)              The method is invoked when any key is
                                    pressed.
keyReleased(KeyEvent e)                The method is invoked when any key is
                                       released.
processMovement(KeyEvent ,boolean      This method sets the movement variable
commandIsActive)
                                       according to the key pressed.




Class – MouseNavigator
This class implements the MouseListener, MouseMotionListenerclass. This class
is invoked whenever a mouse movement is performed by the user.
Methods                                Description
mouseClicked(MouseEvent arg0)          The method is invoked when the mouse
                                       is clicked.
mouseMoved(MouseEvent arg0)            The method is invoked when mouse is
                                       moved.



Class – MatrixStack
This class contains the matrix operations. 2 Matrix stacks are created one for the
plate and one for the ball.
Methods                                Description
push(double[][] matrix)                The method is invoked when push
                                       operation is performed on the matrix
                                       stack
pop()                                  The     method   is   invoked   when   pop
                                       operation is performed on the matrix
                                       stack
flushStack()                           This method clears the matrix stack.
Class – NGonBall
This class is used to create a Ngon Ball used for the Game
Methods                               Description
drawNGon(double x, double y)          The method is used to generate the
                                      tuples for the Ngon Ball.




There are some more classes used for applying texture like BitmapLoader for
loading the bmp file, ResourceRetriever, TextureLoader. Not all the methods for
these classes are mentioned above.


Description about all the methods and classes can be retrieved from the java doc
presented in the project.
3.2    Class Diagram

      The below figure shows the list of classes used in this project and the
dependencies between the classes.




                                    Fig.1
4 Implementation
      In this section the algorithm used for the game is discussed. The main
algorithm consists of the collision detection of the ball with the boundary, bricks
and the plate.
     Later in the appendix section the screenshot of the game is shown



4.1 Collision detection Algorithm

 1. The ball’s position is updated by incrementing/decrementing the ‘x’ value
     and incrementing/decrementing the ‘y’ value.
 2. For every display call
          // updating with ‘x’ value
        a. If ball’s minimum ‘x’ bound equals the left boundary of the play area
                 i. Increment ‘x’ by 0.1
             Else
                 ii. Decrement ‘x’ by 0.1


        b. If ball’s maximum ‘x’ bound equals the right boundary of the play area
                 i. Decrement ‘x’ by 0.1
             Else
                 ii. Increment ‘x’ by 0.1


        c. If ball’s minimum ‘y’ bound equals the top of the plate and if the ‘x’
            value of the ball lies within the ‘x’ bounds of the plate
                 i. Increment ‘y’ by 0.1 and increment/decrement ‘x’ based on the
                    place of coincidence of the ball.
             Else
                 ii. Decrement ‘Y’ by 0.1 and the ball is missed. So, lives count is
                    reduced by 1.
//To detect collision


      d. For each brick
              i. If the brick has not been collided
                     1. If the midpoint of the ball lies within the ‘x’ and ‘y’
                         bounds brick vertices,
                             a. Ball collided the brick
                             b. Increment/decrement ‘x’ and ‘y’ values according
                                  to the movement of the ball i.e. based on the
                                  previous values of the ‘x’ and ‘y’


                     2. If the top of the ball touches the bottom of the brick
                         side,
                             a. Ball collided the brick
                             b. Increment/decrement ‘x’ and decrement ‘y’
                                  values according to the movement of the ball i.e.
                                  based on the previous values of the ‘x’ and ‘y’


                     3. If the max/min ‘x’ of the ball touches the sides of the
                         brick,
                             a. Ball collided the brick
                             b. Increment/decrement ‘x’ and decrement ‘y’
                                  values according to the movement of the ball i.e.
                                  based on the previous values of the ‘x’ and ‘y’



4.2 Additional Features

                •   Three lives are provided for the user
                •   Game can be played using either keyboard or mouse
                •   Bonus points are awarded to the user if he breaks the bricks
                    in blue color.
•   When the Blue bricks are hit, the five bricks adjacent to it are
                       broken as bonus.
                   •   Another type of bonus is given, when a green brick is broken
                       the ball attaches to the plate automatically till the next life is
                       lost. This feature allows the user to target on more bricks
                       and increase the score



4.3 Software Details

Development IDE                               Eclipse Version: 3.2.2
Operating System                              Windows XP
Other Technologies Used                       Java Swing
Library Used                                  JOGL 1.1.0
Programming language                          JAVA
Important Jar files Used for JOGL             jogl.jar
                                              gluegen-rt.jar



5 Conclusion & Future Work
               Hence in this project an interactive Arkanoid game using JOGL has
been implemented. It also incorporates all the features learnt during the course
for example applying Texture, Ngon object, transformation matrices etc. Hence
this project was a very good start for developing good video games with 2D and
3D features


The following are the possible extensions to the game
          •    Can have levels with various difficulty like Beginner, Intermediate,
               Expert etc.
          •    Can be extended as a multi player game
6 References
  1. “OpenGL RedBook – OpenGL programming Guide “, Dave Astle,Kelvin
     Hawkins
  2. Tutorial for applying Texture
     http://www.paulsprojects.net/tutorials/simplebump/simplebump.html
  3. Open GL command Reference
     http://www.ncrg.aston.ac.uk/~cornfosd/graphics/opengl/openglman.html
  4. Course Lecture slides
7 Appendix

7.1 Game Screenshot

Contenu connexe

Tendances

Introduction to CNN
Introduction to CNNIntroduction to CNN
Introduction to CNNShuai Zhang
 
OpenCV presentation series- part 1
OpenCV presentation series- part 1OpenCV presentation series- part 1
OpenCV presentation series- part 1Sairam Adithya
 
Artificial Neural Network | Deep Neural Network Explained | Artificial Neural...
Artificial Neural Network | Deep Neural Network Explained | Artificial Neural...Artificial Neural Network | Deep Neural Network Explained | Artificial Neural...
Artificial Neural Network | Deep Neural Network Explained | Artificial Neural...Simplilearn
 
Convolutional neural network
Convolutional neural networkConvolutional neural network
Convolutional neural networkMojammilHusain
 
Denoising autoencoder by Harish.R
Denoising autoencoder by Harish.RDenoising autoencoder by Harish.R
Denoising autoencoder by Harish.RHARISH R
 
Generative adversarial networks
Generative adversarial networksGenerative adversarial networks
Generative adversarial networksYunjey Choi
 
GDC2019 - SEED - Towards Deep Generative Models in Game Development
GDC2019 - SEED - Towards Deep Generative Models in Game DevelopmentGDC2019 - SEED - Towards Deep Generative Models in Game Development
GDC2019 - SEED - Towards Deep Generative Models in Game DevelopmentElectronic Arts / DICE
 
Machine Learning - Convolutional Neural Network
Machine Learning - Convolutional Neural NetworkMachine Learning - Convolutional Neural Network
Machine Learning - Convolutional Neural NetworkRichard Kuo
 
Z Buffer Optimizations
Z Buffer OptimizationsZ Buffer Optimizations
Z Buffer Optimizationspjcozzi
 
[系列活動] 一日搞懂生成式對抗網路
[系列活動] 一日搞懂生成式對抗網路[系列活動] 一日搞懂生成式對抗網路
[系列活動] 一日搞懂生成式對抗網路台灣資料科學年會
 
Abalanche - Unity Shader Graph #1: Shader & PBR Materials
Abalanche - Unity Shader Graph #1: Shader & PBR MaterialsAbalanche - Unity Shader Graph #1: Shader & PBR Materials
Abalanche - Unity Shader Graph #1: Shader & PBR MaterialsPhuong Hoang Vu
 
Unity Visual Effect Graph
Unity Visual Effect GraphUnity Visual Effect Graph
Unity Visual Effect GraphPhuong Hoang Vu
 
Deferred Rendering in Killzone 2
Deferred Rendering in Killzone 2Deferred Rendering in Killzone 2
Deferred Rendering in Killzone 2ozlael ozlael
 
CNN Machine learning DeepLearning
CNN Machine learning DeepLearningCNN Machine learning DeepLearning
CNN Machine learning DeepLearningAbhishek Sharma
 
Generative adversarial networks
Generative adversarial networksGenerative adversarial networks
Generative adversarial networks남주 김
 
Object recognition of CIFAR - 10
Object recognition of CIFAR  - 10Object recognition of CIFAR  - 10
Object recognition of CIFAR - 10Ratul Alahy
 

Tendances (20)

Introduction to CNN
Introduction to CNNIntroduction to CNN
Introduction to CNN
 
Programming with OpenGL
Programming with OpenGLProgramming with OpenGL
Programming with OpenGL
 
OpenCV presentation series- part 1
OpenCV presentation series- part 1OpenCV presentation series- part 1
OpenCV presentation series- part 1
 
Artificial Neural Network | Deep Neural Network Explained | Artificial Neural...
Artificial Neural Network | Deep Neural Network Explained | Artificial Neural...Artificial Neural Network | Deep Neural Network Explained | Artificial Neural...
Artificial Neural Network | Deep Neural Network Explained | Artificial Neural...
 
Convolutional neural network
Convolutional neural networkConvolutional neural network
Convolutional neural network
 
Denoising autoencoder by Harish.R
Denoising autoencoder by Harish.RDenoising autoencoder by Harish.R
Denoising autoencoder by Harish.R
 
Generative adversarial networks
Generative adversarial networksGenerative adversarial networks
Generative adversarial networks
 
Lighting the City of Glass
Lighting the City of GlassLighting the City of Glass
Lighting the City of Glass
 
GDC2019 - SEED - Towards Deep Generative Models in Game Development
GDC2019 - SEED - Towards Deep Generative Models in Game DevelopmentGDC2019 - SEED - Towards Deep Generative Models in Game Development
GDC2019 - SEED - Towards Deep Generative Models in Game Development
 
Machine Learning - Convolutional Neural Network
Machine Learning - Convolutional Neural NetworkMachine Learning - Convolutional Neural Network
Machine Learning - Convolutional Neural Network
 
Z Buffer Optimizations
Z Buffer OptimizationsZ Buffer Optimizations
Z Buffer Optimizations
 
Object detection
Object detectionObject detection
Object detection
 
[系列活動] 一日搞懂生成式對抗網路
[系列活動] 一日搞懂生成式對抗網路[系列活動] 一日搞懂生成式對抗網路
[系列活動] 一日搞懂生成式對抗網路
 
Abalanche - Unity Shader Graph #1: Shader & PBR Materials
Abalanche - Unity Shader Graph #1: Shader & PBR MaterialsAbalanche - Unity Shader Graph #1: Shader & PBR Materials
Abalanche - Unity Shader Graph #1: Shader & PBR Materials
 
Unity Visual Effect Graph
Unity Visual Effect GraphUnity Visual Effect Graph
Unity Visual Effect Graph
 
Deferred Rendering in Killzone 2
Deferred Rendering in Killzone 2Deferred Rendering in Killzone 2
Deferred Rendering in Killzone 2
 
CNN Machine learning DeepLearning
CNN Machine learning DeepLearningCNN Machine learning DeepLearning
CNN Machine learning DeepLearning
 
Generative adversarial networks
Generative adversarial networksGenerative adversarial networks
Generative adversarial networks
 
Object recognition of CIFAR - 10
Object recognition of CIFAR  - 10Object recognition of CIFAR  - 10
Object recognition of CIFAR - 10
 
Attention Models (D3L6 2017 UPC Deep Learning for Computer Vision)
Attention Models (D3L6 2017 UPC Deep Learning for Computer Vision)Attention Models (D3L6 2017 UPC Deep Learning for Computer Vision)
Attention Models (D3L6 2017 UPC Deep Learning for Computer Vision)
 

Similaire à Arkanoid Game JOGL Implementation

COMPUTER GRAPHICS PROJECT REPORT
COMPUTER GRAPHICS PROJECT REPORTCOMPUTER GRAPHICS PROJECT REPORT
COMPUTER GRAPHICS PROJECT REPORTvineet raj
 
OpenGL Fixed Function to Shaders - Porting a fixed function application to “m...
OpenGL Fixed Function to Shaders - Porting a fixed function application to “m...OpenGL Fixed Function to Shaders - Porting a fixed function application to “m...
OpenGL Fixed Function to Shaders - Porting a fixed function application to “m...ICS
 
openGL basics for sample program (1).ppt
openGL basics for sample program (1).pptopenGL basics for sample program (1).ppt
openGL basics for sample program (1).pptHIMANKMISHRA2
 
openGL basics for sample program.ppt
openGL basics for sample program.pptopenGL basics for sample program.ppt
openGL basics for sample program.pptHIMANKMISHRA2
 
Advanced Graphics Workshop - GFX2011
Advanced Graphics Workshop - GFX2011Advanced Graphics Workshop - GFX2011
Advanced Graphics Workshop - GFX2011Prabindh Sundareson
 
Computer Graphics - Lecture 01 - 3D Programming I
Computer Graphics - Lecture 01 - 3D Programming IComputer Graphics - Lecture 01 - 3D Programming I
Computer Graphics - Lecture 01 - 3D Programming I💻 Anton Gerdelan
 
OpenGL ES based UI Development on TI Platforms
OpenGL ES based UI Development on TI PlatformsOpenGL ES based UI Development on TI Platforms
OpenGL ES based UI Development on TI PlatformsPrabindh Sundareson
 
Computer Graphics Project Report on Sinking Ship using OpenGL
Computer Graphics Project Report on Sinking Ship using OpenGL Computer Graphics Project Report on Sinking Ship using OpenGL
Computer Graphics Project Report on Sinking Ship using OpenGL Sharath Raj
 
Computer Graphics with OpenGL presentation Slides.pptx
Computer Graphics with OpenGL presentation Slides.pptxComputer Graphics with OpenGL presentation Slides.pptx
Computer Graphics with OpenGL presentation Slides.pptxAnandM62785
 
CS 354 Viewing Stuff
CS 354 Viewing StuffCS 354 Viewing Stuff
CS 354 Viewing StuffMark Kilgard
 
Dynamic sorting algorithm vizualizer.pdf
Dynamic sorting algorithm vizualizer.pdfDynamic sorting algorithm vizualizer.pdf
Dynamic sorting algorithm vizualizer.pdfAgneshShetty
 
Porting the Source Engine to Linux: Valve's Lessons Learned
Porting the Source Engine to Linux: Valve's Lessons LearnedPorting the Source Engine to Linux: Valve's Lessons Learned
Porting the Source Engine to Linux: Valve's Lessons Learnedbasisspace
 
Mini Project final report on " LEAKY BUCKET ALGORITHM "
Mini Project final report on " LEAKY BUCKET ALGORITHM "Mini Project final report on " LEAKY BUCKET ALGORITHM "
Mini Project final report on " LEAKY BUCKET ALGORITHM "Nikhil Jain
 

Similaire à Arkanoid Game JOGL Implementation (20)

COMPUTER GRAPHICS PROJECT REPORT
COMPUTER GRAPHICS PROJECT REPORTCOMPUTER GRAPHICS PROJECT REPORT
COMPUTER GRAPHICS PROJECT REPORT
 
OpenGL Fixed Function to Shaders - Porting a fixed function application to “m...
OpenGL Fixed Function to Shaders - Porting a fixed function application to “m...OpenGL Fixed Function to Shaders - Porting a fixed function application to “m...
OpenGL Fixed Function to Shaders - Porting a fixed function application to “m...
 
openGL basics for sample program (1).ppt
openGL basics for sample program (1).pptopenGL basics for sample program (1).ppt
openGL basics for sample program (1).ppt
 
openGL basics for sample program.ppt
openGL basics for sample program.pptopenGL basics for sample program.ppt
openGL basics for sample program.ppt
 
Advanced Graphics Workshop - GFX2011
Advanced Graphics Workshop - GFX2011Advanced Graphics Workshop - GFX2011
Advanced Graphics Workshop - GFX2011
 
Computer Graphics - Lecture 01 - 3D Programming I
Computer Graphics - Lecture 01 - 3D Programming IComputer Graphics - Lecture 01 - 3D Programming I
Computer Graphics - Lecture 01 - 3D Programming I
 
glu1_3.pdf
glu1_3.pdfglu1_3.pdf
glu1_3.pdf
 
OpenGL ES based UI Development on TI Platforms
OpenGL ES based UI Development on TI PlatformsOpenGL ES based UI Development on TI Platforms
OpenGL ES based UI Development on TI Platforms
 
Computer Graphics Project Report on Sinking Ship using OpenGL
Computer Graphics Project Report on Sinking Ship using OpenGL Computer Graphics Project Report on Sinking Ship using OpenGL
Computer Graphics Project Report on Sinking Ship using OpenGL
 
Android native gl
Android native glAndroid native gl
Android native gl
 
Open gl
Open glOpen gl
Open gl
 
Opengl basics
Opengl basicsOpengl basics
Opengl basics
 
Computer Graphics with OpenGL presentation Slides.pptx
Computer Graphics with OpenGL presentation Slides.pptxComputer Graphics with OpenGL presentation Slides.pptx
Computer Graphics with OpenGL presentation Slides.pptx
 
18csl67 vtu lab manual
18csl67 vtu lab manual18csl67 vtu lab manual
18csl67 vtu lab manual
 
CS 354 Viewing Stuff
CS 354 Viewing StuffCS 354 Viewing Stuff
CS 354 Viewing Stuff
 
Dynamic sorting algorithm vizualizer.pdf
Dynamic sorting algorithm vizualizer.pdfDynamic sorting algorithm vizualizer.pdf
Dynamic sorting algorithm vizualizer.pdf
 
Porting the Source Engine to Linux: Valve's Lessons Learned
Porting the Source Engine to Linux: Valve's Lessons LearnedPorting the Source Engine to Linux: Valve's Lessons Learned
Porting the Source Engine to Linux: Valve's Lessons Learned
 
Mini Project final report on " LEAKY BUCKET ALGORITHM "
Mini Project final report on " LEAKY BUCKET ALGORITHM "Mini Project final report on " LEAKY BUCKET ALGORITHM "
Mini Project final report on " LEAKY BUCKET ALGORITHM "
 
Open gles
Open glesOpen gles
Open gles
 
Computer graphics workbook
Computer graphics workbookComputer graphics workbook
Computer graphics workbook
 

Plus de graphitech

A graphic library and an application for simple curve manipolation
A graphic library and an application for simple curve manipolationA graphic library and an application for simple curve manipolation
A graphic library and an application for simple curve manipolationgraphitech
 
A graphic library and an application for simple curve manipolation
A graphic library and an application for simple curve manipolationA graphic library and an application for simple curve manipolation
A graphic library and an application for simple curve manipolationgraphitech
 
A graphic library and an application for simple curve manipolation
A graphic library and an application for simple curve manipolationA graphic library and an application for simple curve manipolation
A graphic library and an application for simple curve manipolationgraphitech
 
A graphic library and an application for simple curve manipolation
A graphic library and an application for simple curve manipolationA graphic library and an application for simple curve manipolation
A graphic library and an application for simple curve manipolationgraphitech
 
Rescue Mission
Rescue MissionRescue Mission
Rescue Missiongraphitech
 
Rescue Mission
Rescue MissionRescue Mission
Rescue Missiongraphitech
 
Mashup - Sustainability
Mashup - SustainabilityMashup - Sustainability
Mashup - Sustainabilitygraphitech
 
Mashup - Sustainability
Mashup - SustainabilityMashup - Sustainability
Mashup - Sustainabilitygraphitech
 
Multiple Screens
Multiple ScreensMultiple Screens
Multiple Screensgraphitech
 
Multiple Screens
Multiple ScreensMultiple Screens
Multiple Screensgraphitech
 
Graph Matching
Graph MatchingGraph Matching
Graph Matchinggraphitech
 
Shape Analysis
Shape AnalysisShape Analysis
Shape Analysisgraphitech
 
Human Interaction Library
Human Interaction LibraryHuman Interaction Library
Human Interaction Librarygraphitech
 
Human Interaction Library
Human Interaction LibraryHuman Interaction Library
Human Interaction Librarygraphitech
 
WebCams Mapping on Nasa World Wind
WebCams Mapping on Nasa World WindWebCams Mapping on Nasa World Wind
WebCams Mapping on Nasa World Windgraphitech
 
Street Builder
Street BuilderStreet Builder
Street Buildergraphitech
 
Street Builder
Street BuilderStreet Builder
Street Buildergraphitech
 
Live Video in World Wind
Live Video in World WindLive Video in World Wind
Live Video in World Windgraphitech
 
Live Video in World Wind
Live Video in World WindLive Video in World Wind
Live Video in World Windgraphitech
 
Terrain Modification
Terrain ModificationTerrain Modification
Terrain Modificationgraphitech
 

Plus de graphitech (20)

A graphic library and an application for simple curve manipolation
A graphic library and an application for simple curve manipolationA graphic library and an application for simple curve manipolation
A graphic library and an application for simple curve manipolation
 
A graphic library and an application for simple curve manipolation
A graphic library and an application for simple curve manipolationA graphic library and an application for simple curve manipolation
A graphic library and an application for simple curve manipolation
 
A graphic library and an application for simple curve manipolation
A graphic library and an application for simple curve manipolationA graphic library and an application for simple curve manipolation
A graphic library and an application for simple curve manipolation
 
A graphic library and an application for simple curve manipolation
A graphic library and an application for simple curve manipolationA graphic library and an application for simple curve manipolation
A graphic library and an application for simple curve manipolation
 
Rescue Mission
Rescue MissionRescue Mission
Rescue Mission
 
Rescue Mission
Rescue MissionRescue Mission
Rescue Mission
 
Mashup - Sustainability
Mashup - SustainabilityMashup - Sustainability
Mashup - Sustainability
 
Mashup - Sustainability
Mashup - SustainabilityMashup - Sustainability
Mashup - Sustainability
 
Multiple Screens
Multiple ScreensMultiple Screens
Multiple Screens
 
Multiple Screens
Multiple ScreensMultiple Screens
Multiple Screens
 
Graph Matching
Graph MatchingGraph Matching
Graph Matching
 
Shape Analysis
Shape AnalysisShape Analysis
Shape Analysis
 
Human Interaction Library
Human Interaction LibraryHuman Interaction Library
Human Interaction Library
 
Human Interaction Library
Human Interaction LibraryHuman Interaction Library
Human Interaction Library
 
WebCams Mapping on Nasa World Wind
WebCams Mapping on Nasa World WindWebCams Mapping on Nasa World Wind
WebCams Mapping on Nasa World Wind
 
Street Builder
Street BuilderStreet Builder
Street Builder
 
Street Builder
Street BuilderStreet Builder
Street Builder
 
Live Video in World Wind
Live Video in World WindLive Video in World Wind
Live Video in World Wind
 
Live Video in World Wind
Live Video in World WindLive Video in World Wind
Live Video in World Wind
 
Terrain Modification
Terrain ModificationTerrain Modification
Terrain Modification
 

Dernier

18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdfssuser54595a
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...Marc Dusseiller Dusjagr
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityGeoBlogs
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxSayali Powar
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxmanuelaromero2013
 
URLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website AppURLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website AppCeline George
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformChameera Dedduwage
 
Science 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its CharacteristicsScience 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its CharacteristicsKarinaGenton
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxGaneshChakor2
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Sapana Sha
 
Hybridoma Technology ( Production , Purification , and Application )
Hybridoma Technology  ( Production , Purification , and Application  ) Hybridoma Technology  ( Production , Purification , and Application  )
Hybridoma Technology ( Production , Purification , and Application ) Sakshi Ghasle
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon AUnboundStockton
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Educationpboyjonauth
 
MENTAL STATUS EXAMINATION format.docx
MENTAL     STATUS EXAMINATION format.docxMENTAL     STATUS EXAMINATION format.docx
MENTAL STATUS EXAMINATION format.docxPoojaSen20
 
Presiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsPresiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsanshu789521
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactdawncurless
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...EduSkills OECD
 

Dernier (20)

Staff of Color (SOC) Retention Efforts DDSD
Staff of Color (SOC) Retention Efforts DDSDStaff of Color (SOC) Retention Efforts DDSD
Staff of Color (SOC) Retention Efforts DDSD
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activity
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptx
 
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdfTataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
 
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
 
URLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website AppURLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website App
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy Reform
 
Science 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its CharacteristicsScience 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its Characteristics
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptx
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
 
Hybridoma Technology ( Production , Purification , and Application )
Hybridoma Technology  ( Production , Purification , and Application  ) Hybridoma Technology  ( Production , Purification , and Application  )
Hybridoma Technology ( Production , Purification , and Application )
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon A
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Education
 
MENTAL STATUS EXAMINATION format.docx
MENTAL     STATUS EXAMINATION format.docxMENTAL     STATUS EXAMINATION format.docx
MENTAL STATUS EXAMINATION format.docx
 
Presiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsPresiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha elections
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
 

Arkanoid Game JOGL Implementation

  • 1. Arkanoid Game Computer Graphics JOGL Implementation Project Raffaele De Amicis, Giuseppe Conti Submitted By Anuradha Jambunathan Matricola: 128682 12 - 02 - 2008
  • 2. Table of Contents 1 Introduction...........................................................................................3 1.1 OpenGL .................................................................................................3 1.2 JOGL......................................................................................................4 1.3 Open GL Commands ............................................................................5 1.3.1 Color Manipulation Commands .......................................................5 1.3.2 Drawing and Matrix Manipulation Commands ...............................5 1.3.3 Stack Manipulation Commands .......................................................6 1.3.4 Texture manipulation Commands ...................................................6 1.3.5 Viewing manipulation commands ...................................................7 2 Requirements........................................................................................8 3 Design Analysis ..................................................................................10 3.1 Classes and Methods .........................................................................10 3.2 Class Diagram.....................................................................................15 4 Implementation ...................................................................................16 4.1 Collision detection Algorithm............................................................16 4.2 Additional Features ............................................................................17 4.3 Software Details..................................................................................18 5 Conclusion & Future Work ................................................................18 6 References ..........................................................................................19 7 Appendix .............................................................................................20 7.1 Game Screenshot ...............................................................................20
  • 3. 1 Introduction Computer games are considered to be the fast growing and more interesting field of study today. The interactive entertainment field makes use of the latest computer technologies and helps for the development of research in areas such as computer simulation, computer aided designing, virtual reality, artificial intelligence etc. Development of games is considered to be the more creative way of software development. Game development requires more of innovative thinking and ideas to work in the imaginary world. OpenGL (Open Graphics Library) is a standard specification which is used to write software application to create 2D and 3D graphics. Open GL is a platform independent API which makes it easy to use and has good performance capability. The Open GL utility library (GLU) provides sophisticated modeling features which are not available in standard Open GL. Java Open GL (JOGL) is a library that’s helps to use the OpenGL in java programming language. It is also easy to program using JOGL with a good programming knowledge of JAVA. This project is developed using JOGL. This project is aimed at developing an Arkanoid game also called as Ball and Bricks game using JOGL. All the inbuilt methods available in Open GL are not used and the own methods are implemented to demonstrate the same functionality. This game is made very simple and interactive for use. The UI designed makes use of all the features of Open GL learnt during the course. The game is designed as a 2D game area embedded in a 3D world to give a feel of playing in 3D world to the user. 1.1 OpenGL OpenGL was developed by Silicon Graphics Inc. (SGI) in 1992. It is a software interface to graphics hardware. It is a standard specification which contains of nearly 150 commands that is used to specify the primitives or objects and create operations that are required to produce 3D applications. It is a
  • 4. hardware independent interface that can be implemented in any hardware platform. It has got two main advantages, first to hide the complexity of the interacting hardware device by providing a single uniform API for the programmer and secondly it is easy to use and provides a good performance and also focus on rendering. Open GL does not have high level complicated commands for creating 3D objects, whereas these features are provided by the library built top on Open GL. Open GL utility library (GLU) is used to create complex objects like sphere, cylinder , quadric surfaces etc. GL utility library (GLU) contains routines which make use of the Open GL low level commands for setting up matrices for viewing and specific transformations etc. Every window system has a library that extends the functionality of the window system to support the OpenGL rendering. GLUT which is the OpenGL utility toolkit is a library which is used to simplify the interaction with the windowing system. GLUT is used to write Open GL programs without taking care about the windowing system. GLUT provides following simplified functionalities like opening a window, getting input from mouse or keyboard, menus etc. 1.2 JOGL Java OpenGL (JOGL) is a library that helps to use Open GL in java programming language. It provides full access to Open GL 2.0 and also it integrates with swing and AWT. It is used to create hardware supported 3D graphics to the applications that are written in Java. It is easy because anyone who has a good knowledge in java can do the program very easily. In this project, the game is developed using JOGL.
  • 5. 1.3 Open GL Commands There are nearly 150 commands present in Open GL. In this section we discuss some of the important commands and the commands which are used in this project 1.3.1 Color Manipulation Commands glClearColor – This specifies the clear values for the color buffers. Values given are between the range 0 and 1. glColor3f – This specifies the red, green and blue color float explicitly and sets the current alpha intensity value to 1. 1.3.2 Drawing and Matrix Manipulation Commands glBegin, glEnd – This command is used as a delimiter of the vertices used to draw a primitive. All the vertices used for drawing a primitive are used inside this enclosing block. glVertex – This command is used within the glBegin and glEnd block to specify the points used to draw the desired primitive. The current color, textures are associated with the vertex when this command is called. glLoadIdentity – This command is used to load the identity matrix by replacing the current matrix in the stack. glMatrixMode – This command specifies which matrix is the currently used one. The mode can take three values which can be one of the following: a. GL_MODELVIEW - This is used to position the view in the scene. Used for 3D modeling, all the operations done are applied on the modelview matrix stack.
  • 6. b. GL_PROJECTION – This defines the way the 3D scene is projected as 2D scene. All the operations done are applied on the projection matrix stack. c. GL_TEXTURE – Applies all the operations on the texture matrix stack. glTranslate – This command is used to translate the current position with the given x, y and z values. The current matrix which is specified previously in the glMatrixMode is multiplied by the translation matrix. The multiplied result replaces the current matrix value. glRotate – This command is used to rotate for the given rotation angle around the vector x, y and z. Similarly the current matrix which is specified previously in the glMatrixMode is multiplied by the rotation matrix. The multiplied result replaces the current matrix value. glScale - This command is used to produce a desired scaling factor along the x, y and z axes. Similarly the current matrix which is specified previously in the glMatrixMode is multiplied by the scaling matrix. The multiplied result replaces the current matrix value. 1.3.3 Stack Manipulation Commands glPushMatrix, glPopMatrix – This command is used to push and pop the current matrix stack used. 1.3.4 Texture manipulation Commands glGenTextures - This command is used to generate texture names with takes as parameter the number of texture to be generated and the array where the generated texture names are stored.
  • 7. glBindTexture – This command is used to bind the name of the texture to the texture target. glTexParameteri – This command assigns the values to the texture parameter specified. The target defines the corresponding texture target. glTexImage2D – This command is used to specify a 2D texture image glTexCoord – This command is used to specify the texture coordinates in 1D, 2D or 3D. The glTextCoord2d used in this project specifies the S-Tangent and T- tangent vales of the texture used. 1.3.5 Viewing manipulation commands glViewport – This command is used to set the view port area by specifying the lower left corner pixel points of the rectangle, height and width of the rectangle area. gluOrtho2D – This command specifies the 2D projection matrix and sets up the 2D orthographic viewing region. It specifies the left and right vertical clipping planes and bottom, top horizontal clipping planes. gluPerspective – This command specifies the view coordinate system into world coordinate system. The aspect ratio should match the view port aspect ratio in order to see the image without any distortion.
  • 8. 2 Requirements This project is aimed at developing an interactive “Arkanoid” game also called as “Ball and Bricks” game using JOGL. The game interface should be easy to use by the user and provide a good visual presentation for attracting the player. Let us look into the requirements for creating this Arkanoid game 1. The Game developed should be an interactive Arkanoid play. 2. The Arkanoid game developed should have a paddle which helps to hold the ball. 3. The ball should bounce inside the play area and target to break the bricks. 4. The ball is allowed only to move inside the play area boundary. 5. Once there is a collision of the ball with the bricks or the play area boundary or the paddle the ball has to bounce in the corresponding direction. 6. The Direction of the ball motion must be calculated based on the direction of the collision. 7. Once the ball hits the target bricks, then the brick should be broken or destroyed. 8. The game score should be shown based on the number of bricks destroyed by the user. 9. Each time the ball is dropped or missed then the lives should be decreased. 10. The maximum number of lives for the player is given as three. 11. The game should be over if all the lives are gone and still there are some bricks which are not broken. 12. Player should win the game if he breaks all the bricks before all the lives are finished. 13. Bonus should be given to the player is the ball hits the selected brick marked in a different color.
  • 9. 14. The Bonus brick should marked in blue color. 15. When the bonus brick is hit by the ball, five bricks adjacent to the bonus brick should be broken and the score should be increased. 16. The Arkanoid play area should a 2D plane embedded in a 3D environment. 17. The Game should be played using keyboard control or using mouse as desired by the player. 18. The User interface should be made more attractive by giving texture for play area, ball and bricks. 19. There should a combined swing frame which displays the current score, lives to the user. 20. There should be also some extra features available to change the background color, rotate the play board after the game etc. 21. The inbuilt Open GL functions like glTranslate; glRotate etc should not be used. Own matrix operations should be implemented to demonstrate the above functionalities. 22. The Game should be developed using JOGL. The game was developed based on the above requirements.
  • 10. 3 Design Analysis In this section, we discuss the object-oriented approach followed in the designing of the game, the actual algorithm used to detect collisions, assumptions and limitations of the game. This game is developed using JOGL and uses Java Swing technology for presentation. 3.1 Classes and Methods The various classes and important methods used are discussed below. Class – BouncingApplication This Class contains the main method. Used for startup of the application. This class contains all the swing components used for this game. The Registration of the GLEventListener, KeyListener, and MousemotionListener is done here. Methods Description main() The main method is invoked by JVM and it instantiates the class (Bouncing Application) and opens the frame (JFrame) and registers the event handlers. Creates the canvas for the renderer display and creates the visual components. Class – BouncingBallRenderer This class extends the GLEventListener, ActionListener and MenuListener. This contains all the graphics related methods and the key algorithm used for collision detection and displaying the graphics. Methods Description init(GLAutoDrawable gLDrawable) This method is called the first time and it
  • 11. initializes the graphics display. The matrixes are set to identity and all textures are created here. This method calls the display display(GLAutoDrawable This method is used for rendering the gLDrawable) graphics. This method is called repeated by using an Animator. This methods contains all the important methods for displaying the game and contains the algorithm used reshape(GLAutoDrawable This method is called when the window is gLDrawable, int x, int y, int resized width, int height) drawBoundaryBox(GL gl) This method is used to draw the outer boundary box of the play area. drawBricks(GL gl) This method is used to draw or display the target bricks to break. checkGameOver() This method is used to check if the game is over. It can be the case if all the bricks are broken or all the lives are finished. updatePlatePosition(GL gl) This method is called to track the new position of the plate moved by the player and draw the new position. This is accomplished by performing the operations on the Plate Matrix Stack drawBallOnPlate(GL gl) This method is used to draw the ball on the plate updateBallPosition() This method is used to calculate the movement of the ball. It increments the x and y value for the movement based on the direction of the bouncing ball. This
  • 12. method contains the logic for the collision detection. calculateStackResult(boolean This method is used to calculate the plate) result of the Plate Matrix stack and Ball Matrix stack based on the Boolean value passed. True for Plate and False for ball. breakBrick(int i) This method is used to break the brick. The parameter value identifies which brick to break. moveCamera(double xvalue, double This method is used to perform the matrix yvalue,double zvalue,boolean operation. The push operation of the isPlate) corresponding matrix stack is done here whenever there is a movement in the ball or the plate. keyPadMovement() This method contains the movement for the key press mouseMovement() This method contains the movement update when mouse control is used. actionPerformed(ActionEvent e) This method is invoked when a button click is done. When the play button, color button is clicked etc. menuSelected(MenuEvent arg0) This method checks the menu (Game control) selected by the user. Class – KeyNavigator This class extends KeyAdapter class. This class is invoked whenever a key is pressed by the user. Methods Description keyPressed(KeyEvent e) The method is invoked when any key is pressed.
  • 13. keyReleased(KeyEvent e) The method is invoked when any key is released. processMovement(KeyEvent ,boolean This method sets the movement variable commandIsActive) according to the key pressed. Class – MouseNavigator This class implements the MouseListener, MouseMotionListenerclass. This class is invoked whenever a mouse movement is performed by the user. Methods Description mouseClicked(MouseEvent arg0) The method is invoked when the mouse is clicked. mouseMoved(MouseEvent arg0) The method is invoked when mouse is moved. Class – MatrixStack This class contains the matrix operations. 2 Matrix stacks are created one for the plate and one for the ball. Methods Description push(double[][] matrix) The method is invoked when push operation is performed on the matrix stack pop() The method is invoked when pop operation is performed on the matrix stack flushStack() This method clears the matrix stack.
  • 14. Class – NGonBall This class is used to create a Ngon Ball used for the Game Methods Description drawNGon(double x, double y) The method is used to generate the tuples for the Ngon Ball. There are some more classes used for applying texture like BitmapLoader for loading the bmp file, ResourceRetriever, TextureLoader. Not all the methods for these classes are mentioned above. Description about all the methods and classes can be retrieved from the java doc presented in the project.
  • 15. 3.2 Class Diagram The below figure shows the list of classes used in this project and the dependencies between the classes. Fig.1
  • 16. 4 Implementation In this section the algorithm used for the game is discussed. The main algorithm consists of the collision detection of the ball with the boundary, bricks and the plate. Later in the appendix section the screenshot of the game is shown 4.1 Collision detection Algorithm 1. The ball’s position is updated by incrementing/decrementing the ‘x’ value and incrementing/decrementing the ‘y’ value. 2. For every display call // updating with ‘x’ value a. If ball’s minimum ‘x’ bound equals the left boundary of the play area i. Increment ‘x’ by 0.1 Else ii. Decrement ‘x’ by 0.1 b. If ball’s maximum ‘x’ bound equals the right boundary of the play area i. Decrement ‘x’ by 0.1 Else ii. Increment ‘x’ by 0.1 c. If ball’s minimum ‘y’ bound equals the top of the plate and if the ‘x’ value of the ball lies within the ‘x’ bounds of the plate i. Increment ‘y’ by 0.1 and increment/decrement ‘x’ based on the place of coincidence of the ball. Else ii. Decrement ‘Y’ by 0.1 and the ball is missed. So, lives count is reduced by 1.
  • 17. //To detect collision d. For each brick i. If the brick has not been collided 1. If the midpoint of the ball lies within the ‘x’ and ‘y’ bounds brick vertices, a. Ball collided the brick b. Increment/decrement ‘x’ and ‘y’ values according to the movement of the ball i.e. based on the previous values of the ‘x’ and ‘y’ 2. If the top of the ball touches the bottom of the brick side, a. Ball collided the brick b. Increment/decrement ‘x’ and decrement ‘y’ values according to the movement of the ball i.e. based on the previous values of the ‘x’ and ‘y’ 3. If the max/min ‘x’ of the ball touches the sides of the brick, a. Ball collided the brick b. Increment/decrement ‘x’ and decrement ‘y’ values according to the movement of the ball i.e. based on the previous values of the ‘x’ and ‘y’ 4.2 Additional Features • Three lives are provided for the user • Game can be played using either keyboard or mouse • Bonus points are awarded to the user if he breaks the bricks in blue color.
  • 18. When the Blue bricks are hit, the five bricks adjacent to it are broken as bonus. • Another type of bonus is given, when a green brick is broken the ball attaches to the plate automatically till the next life is lost. This feature allows the user to target on more bricks and increase the score 4.3 Software Details Development IDE Eclipse Version: 3.2.2 Operating System Windows XP Other Technologies Used Java Swing Library Used JOGL 1.1.0 Programming language JAVA Important Jar files Used for JOGL jogl.jar gluegen-rt.jar 5 Conclusion & Future Work Hence in this project an interactive Arkanoid game using JOGL has been implemented. It also incorporates all the features learnt during the course for example applying Texture, Ngon object, transformation matrices etc. Hence this project was a very good start for developing good video games with 2D and 3D features The following are the possible extensions to the game • Can have levels with various difficulty like Beginner, Intermediate, Expert etc. • Can be extended as a multi player game
  • 19. 6 References 1. “OpenGL RedBook – OpenGL programming Guide “, Dave Astle,Kelvin Hawkins 2. Tutorial for applying Texture http://www.paulsprojects.net/tutorials/simplebump/simplebump.html 3. Open GL command Reference http://www.ncrg.aston.ac.uk/~cornfosd/graphics/opengl/openglman.html 4. Course Lecture slides
  • 20. 7 Appendix 7.1 Game Screenshot