Figa17
Figa17

Reputation: 781

How to refresh window inside the idle function in GLUT

Im using GLUT and i need to refresh a draw inside the idle function, my code is something like that:

void idle(){

     for(int i ;i<cant;i++){

          /* do some stuff*/

          glutPostRedisplay();
     }
}

inside the idle function proccess de data what i want to redraw in every itaration.

Someone can help me?

Upvotes: 0

Views: 640

Answers (1)

Fabrice NEYRET
Fabrice NEYRET

Reputation: 734

Do one (or few) things in idle, then postRedisplay. Let the timer (calling idle) do the loop !

you should ensure than the computation load of idle + redisplay is largely less than the timer rate you required (or the FPS you expect).

Upvotes: 3

Related Questions