Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Zeqeus

help a newbie

This topic is 6029 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

hi reader okay...im working on a mini project done in opengl in which i have a player shooting a ball fomr different positions. the user is allowed to move the player around in the basketball court and shoot from anywhere. the problem is the shooting part. i designed an algorothim to make the ball movement look relaistic it uses a for loop like this, for(whatever...doesnt matter) { .... (my algorithm, basically compute a coord that the ball) .... (will pass through) .... glutPostRedisplay() } problem is i found out that calls to glutPostRedisplay() are coaleced. How do i make it so that each call to glutPostRedisplay() affects the window and is not overlayed

Share this post


Link to post
Share on other sites
Advertisement
Keep track of the ball''s position and velocity in a global, and run the update on the position in your Idle() function (registered with glutIdleFunc()) instead of in a for loop. You may want to time the interval between two calls to Idle() to get a framerate independent solution.

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!