Twin Cars Game Computer Graphics Project in OpenGL Source Code – 18CSL67

 

Twin Cars Game Computer Graphics Project in OpenGL Source Code – 18CSL67

Here you can download the source code Twin Cars Game Computer Graphics Project in OpenGL – 18CSL67 academic mini-project.

Video Demonstration:

Project Description

TWIN CARS is a simple and user-friendly graphics modeling developed using C programming language and OpenGL library. It is a intresting game which consists of two cars.

Some other features include Menus, Text Fonts. A range of colors and patterns has been chosen.

Some of the options that can be performed are.

It consists of two paths were each path consists of a car.

Random square blocks will be moving on the path with the y axis.

We must move both the cars according to the x-axis using keyboard buttons such as a/A,d/D,j/J,l/L. such that it must not collide with the blocks.

If either car is collide with the block the game ends and the score card is displayed.

Module Description

Main – In OpenGL, GLUT runs as a console application starting at main. The glutInit() initializes the window system and to enable the single buffered mode glutInitDisplayMode(GLUT_SINGLE) is used. The size and position of the window is defined using glutInitWindowSize(width,height), glutInitWindowPosition(posX,posY) respectively. The window is created using glutCreateWindow(“TWIN CARS”) and the name of the created window is given in quotes. The following functions are registered to be used in the program :

1. glutDisplayFunc(display)

2. glutReshapeFunc()

3. glutKeyboardFunc()

4.glutIdelFunc(mov);

And finally, glutMainLoop() is used to enter the event processing loop and calls the functions which are registered in the body of the main function.

Display – The display function registers call back handler for window re-paint. In this function two functions are being called displayCAR() and scoredisp(). The glMatrixMode() API is used to operate on the model-view matrix and glLoadIdentity() API is used to reset the model-view matrix. These APIs are called before calling the functions displayCAR() and scoredisp() and finally glFlush() forces the buffered OpenGL commands to execute.

displayCAR – This function is used to display the CAR and  Initially the color of the CAR is set to red using glColor3f(1.0,0.0,0.0) API. The two variables X and Y are used to compute the location of the next refresh.  

scoredisp – This function is used to display the score. The glRasterPos() API is used to set the X and y-axis for the text. The glutbitmapCharacter(void font, int character) API is used to render the character in the named bitmap font. With every click on the ball, the score will be implemented.

Mov – This is idel function used to mov the objects according to y axis.

Msg – This function is used to Display the message and instryctions in the begining of game.

Msg2 – This function is used to display the message as GAME OVER when the car collides to the objects.

Flowchart of Twin Cars Computer Graphics Project

Twin Cars Computer Graphics Project in OpenGL Source Code – 18CSL67

Screenshots of Twin Cars Computer Graphics Project

Initial page of  Twin Cars Computer Graphics Project

Initial page of Twin Cars Computer Graphics Project

Game of  Twin Cars Computer Graphics Project

Game of Twin Cars Computer Graphics Project

Game Over status of  Twin Cars Computer Graphics Project

Game Over status of Twin Cars Computer Graphics Project

Subscribe to our YouTube channel for more videos and like the Facebook page for regular updates.

3 thoughts on “Twin Cars Game Computer Graphics Project in OpenGL Source Code – 18CSL67”

Leave a Comment

Your email address will not be published. Required fields are marked *

Welcome to VTUPulse.com


Computer Graphics and Image Processing Mini Projects -> Click Here

Download Final Year Project -> Click Here

This will close in 12 seconds