Hey guys im kind of a beginner on openGL, im trying to make this ball bounce using this code but it runs in super speed, any idea what im doing wrong??
im using Xcode on mac btw..
Such are your numbers. Xpos starts from 0.4 and Xvel is 0.2, so after 2 frames Xpos will be 0 and after 1 second (let's pretend that fps = 60, though glut doesn't force it to be 60, so it might be much more) Xpos = -11.6.
Try initializing Ypos = 1.0, Yvel = 0, G = 0.01; (I'm just guessing. If you need to increase height, increase Ypos. If you and to make it slower, decrease G)
And then in idle(), Ypos += Yvel; Yvel-=G; if( Ypos <= 0 ) Yvel = - Yvel;