Skip to content

sharathbp/WarAndPeace

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

67 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

WarAndPeace

cg2 Plane Fight game using OpenGL and C++. This is a simple game where the player has to shoot the opponent. There is also dual player mode. The animation of armstice is also done using OpenGL transformation functions.

Basic Controls

PLAYER 1

  • a - to move left
  • d - to move right
  • w/SPACE - to shoot
    PLAYER 2:
  • <- - to move left
  • -> - to move right
  • left mouse click - to shoot

Dependencies : freeglut, stb

For Fedora : yum install freeglut-devel

For Ubuntu : sudo apt install freeglut3 freeglut3-dev

cmd to build(for linux) : make -f Makefile

cmd to build(for windows): make -f makefile.win

Concepts used

  • Here I have used gluPerspective for the projection matrix which helps to see the near objects bigger and far objects smaller.

  • Terrain is implemented using GL_TRIANGLE_STRIP and choosing random z value for the appearance of uneven surface. Textures have been added for realistic view. To Load the image to texture stb_image library is used.

  • OpenGL timer functions are used to update the positions to the objects in the scene and to provide slow movement to the objects. The C++ STL i.e lists are used to store the co ordinates of the objects in the scene.

  • GLLight is used to give lighting and shading to the scene. By using lighting we can change the theme from day to night and vice versa. GL_AMBIENT, GL_SPECULAR and GL_DIFFUSE are used to set the type to material which behave differently to light.

  • freeglut is window creating library which is used to handle window related options. It is used to create menus, add KeyboardFunc and MouseFunc.

plane If you clicked War the above screen appears. You can right click to start the game.

cg5 This is the final scene.

About

Plane Fight game using OpenGL .

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published