Friday 24 March 2017

Computer Graphics- 14. Car Race Game Using OpenGL

2D Car Racing Game using OpenGL


IT IS A COMPUTER GRAPHICS PROJECT MADE USING VISUAL STUDIO. IN THIS PROJECT IT SHOWS ABOUT 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 CAR RACE and the implementation and demonstration of CAR RACE using the computer graphics and OpenGL API.

 

We all Like Game and most engineers are used to games on PC not because they want to play but they want other to play it as well. Bike or Car Racing games are one of favorite of every engineers. I might think most of you also like playing those racing games. In my days of college I had my hands on "Needs for Speed". I had played it several times alone and with my friends. In our College we had competition for it, do this happens in you college also? Tell us in your comments.

You all might thinking why I talking about it?

Well Today's projects is about Car Racing Game we are going to develop a 2d Car Racing Game in OpenGL.  We had already seen formula one car racing opengl game project in our previous post. Though compare to that project this is little easy to do as well as has less no of lines of code.  In that project we have different angle of views but here we don't have. Also there track were as in real formula one race with turning while in this, we have simple road. This project has one advantage that there is scoring system in it. You will find this more adorable, enjoyable and sophisticated.

 

 Different Options for 2d Car Racing Game OpenGL Projects

View the following Code  OpenGL C++ Program executed in Visual Studio. 

void Specialkey(int key, int x, int y)
{
switch(key)
{
case GLUT_KEY_UP: 
for(i = 0; i <4; i++)
             {
              ovehicleY[i] = ovehicleY[i] - 10;  
             }
             movd = movd - 20;
             break;
case GLUT_KEY_DOWN: 
for(i = 0; i <4; i++)
             {
              ovehicleY[i] = ovehicleY[i] + 10;  
             }
             movd = movd + 20;
             break;
case GLUT_KEY_LEFT:vehicleX = 200;
             break;
case GLUT_KEY_RIGHT:vehicleX = 300;
             break;
}

glutPostRedisplay();
}

It is special key function,which allows us to activate the navigation key for the 2d Car Racing Game OpenGL Projects, helps in moving the car left to right and vice-versa along with speed up and down. We don't have the ASCII code for navigation key which can be viewed in Wikipedia. In the glut.h these special function defined for the arrow key or navigation keys.

Color of the car can be easily changeable, set the RGB value and see yourself. Same is true with the screen or road side but road should be either change to black and stip mark in white color to make it real or default as set in the programESC key press at any time quit the program.

Most of the objects drawn in this race game opengl program are either rectangle or quadrilateral, mean purely the primitive objects. Code is easy to understand as comments are there. Hope you enjoy this C++ graphics program.


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.

2 comments:

  1. I will immediately grab your rss feed as I can't find your e-mail subscription link or newsletter service. Do you've any? Kindly let me know in order that I could subscribe. Thanks.latest lifestyle news

    ReplyDelete
  2. Amazing info! Rev up your engine and join the ultimate car race Brisbane! Earn top dollar for your vehicle with our Cash for Cars Near Brisbaneprogram. Don't miss out on the thrill of the competition and the opportunity to turn your car into cash!

    ReplyDelete