Simple Opengl Program - Bouncing Ball

Learn how to draw simple opengl program the Bouncing Ball in opengl in C computer graphics.
Rajeev
Simple Opengl Program - Bouncing Ball
We have shared so many OpenGL Programs, today we are going to share a simple opengl program on Bouncing Ball. This program is simple, easy to code and understand as well, you can modify the program easily and made it into a superb project. Code Bouncing Ball C Program Initialization First we create a flag which will check the ball's uppermost position and lower most position. we will also define the coordinate of ball that varies as it bounce. The coordinate will be determine by a certain variable which changes the coordinate position by an amount which we fix.  static int flag=0; float tx=0.0,ty=0.0,tz=0.0; float ball_x=0.5,ball_y=0.0,ball_z=0.0; Draw and Update Ball In this Simple Opengl Program we are going to create a procedure that will update the position of ball according to it's motion upward and downward. The function will use the variable flag  as mentioned above. The update ball function will update the position of the ball of up and down.  void updateBall() {     …

Post a Comment