Glass Cracking Computer Graphics Project in OpenGL Source Code – 18CSL67
Here you can download Glass Cracking Computer Graphics Project in OpenGL – 18CSL67 Source Code for an academic mini-project.
This mini-project demonstrates how glass cracking happens. In this project, we have used three objects such as sphere(ball), cube(glass), and lines(cracks). The sphere is drawn by using the standard API glutSolidSphere(). The cube is drawn by using the vertices and each vertex is having different color so the colored cube is get displayed. Our project demonstrates that when the ball falls on the glass the glass is cracked means some lines are displayed on the glass.
Some of the operations that are used to implement the “glass cracking” are:
The front page is created to introduce about mini-project.
Instruction page created to introduce key which is used to operate.
Creating the cube (glass) that is placed at the bottom position by using glTranslatef().
Creating the sphere (ball) by using glutSolidSphere() and it is placed at top position using glTranslatef().
To fall the ball on the glass mytimer() function is used.
To increase the ball speed we are using the “i” or “I” key of the keyboard and to decrease the ball speed either press key “d” or “D” key of the keyboard.
When the ball falls on the glass the glass will be cracked and that is done by using glBegin(GL_LINES); Where some vertices are used to draw the lines.
When we press the right button of the mouse the menu is displayed. There are two menu entries “quit” and “color”. We used three colors red, green, blue and the color is related to the sphere only. When clicking on red or green or blue the color of the sphere changes not the color of the cube.
Flowchart of Glass Cracking Computer Graphics Project
Screenshots of Glass Cracking Computer Graphics Project
Intil Position of glass
Glass position after ball hitting