glutmainloop again!!!

Hi ,
I have this program that describe how a certain object moves. I like to use opengl to show how the object moves. But once I enter glut main loop i cannot leave to do more calculations to get the next position of the object. What can i do?

Do it in your idle function.