i have a ball which i have to drop from a height and it should behave as it behave in the real world mean it should drop with g=9.8 and also bounce back.can any one tell me how i can do it in open gl in c++?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
OpenGL is only for drawing 3D graphics, it knows nothing of concepts like speed, mass, velocity, time, acceleration and gravity (or rhubarb pie calorie count, for that matter).
You need a physics engine, or a simple physics simulation:
The simple per-frame loop goes something like this:
That being said, there are people who implement particle systems using OpenGL GPUs for simulation, but then adapt the graphics concepts, primitives & calculations to compute positions and velocities by implementing the physics equations themselves..