Friday, 24 March 2017

Computer Graphics- 12. 2D Car Race Using OpenGL

2D Car Race using OpenGL


IT IS A COMPUTER GRAPHICS PROJECT MADE USING VISUAL STUDIO. IN THIS PROJECT IT SHOWS ABOUT 2D CAR RACE.

Programming in Visual C++ Using OpenGL, Introduces the three-dimensional computer graphics with OpenGL.

In this post I am going to show the OpenGL code on 2D CAR RACE and the implementation and demonstration of 2D CAR RACE using the computer graphics and OpenGL API.

Like in video game, Car race, we have seen the cars are shaped in rectangular shape. The black meter lined road is coded on which the cars raced. There are 6 lanes in the road on which racer have to move with care to avoid collision. 



Earlier in our many game programs we have much impressive menu or instruction for user. This opengl program also display the menu while game being played. You can see in the image above. The score is also written at the top.


HOW TO PLAY

In menu the basic instruction has been shown but many skipped due to low area to display text. All the other user interaction of this opengl program are mentioned below - 

Start and End
s  - start the game
q - quit the game and exist the program

Color change
Change the track and background color (when game end and show shown).
0 - to white
1 - to red
3 -  to blue

Game Play
2 - down or de-accelerate
4 - toward left
6 - toward right
8 - up or accelarate

Note : In this OpenGL program we have used the glutStrokeCharacter

NAME
       glutStrokeCharacter  -  renders  a  stroke character using OpenGL.

SYNTAX
       void glutStrokeCharacter(void *font, int character);

ARGUMENTS
       font      Stroke font to use.

       character Character to render (not confined to 8 bits).

DESCRIPTION
       Without using any display lists, glutStrokeCharacter  ren
       ders the character in the named stroke font. The available
       fonts are:

       GLUT_STROKE_ROMAN
               A proportionally spaced  Roman  Simplex  font  for
               ASCII  characters  32 through 127. The maximum top
               character in the font is 119.05 units; the  bottom
               descends 33.33 units.

       GLUT_STROKE_MONO_ROMAN
               A  mono-spaced  spaced  Roman  Simplex  font (same
               characters as GLUT_STROKE_ROMAN) for ASCII characte
               ters  32 through 127. The maximum top character in
               the font is  119.05  units;  the  bottom  descends
               33.33  units. Each character is 104.76 units wide.

       Rendering  a  nonexistent  character  has  no  effect.   A
       glTranslatef  is  used to translate the current model view
       matrix to advance the width of the character.


All these objects are designed with simple OpenGL graphics objects. Do buy the project and I think you will like this project as well put your comment and let us know what more need to be added in this. Also help by contributing your projects either modified or new, we are going to publish your project on this blog with your name.It is a humble request as I single hand can't help student reach that much of projects.

""Type your email-id in the comment box and pay INR 400 on 
1). Paytm no. 7795746605   or
2). Paypal id:- paypal.me/abhishekabhi/400inr
for code & send payment details to solutionsbyabhi@gmail.com""

Please Hit the like button and subscribe the channel (subscription is FREE OF COST) and you will get new video notification next time.

No comments:

Post a Comment