Problem Calling Repaint without using glutIdleFunc()

I want to call repaint function only when there is change in the screen ,but right now i am using glutIdleFunc() which constantly calls the repaint function.This is hampering the performance of my application.Is there any better way of doing so?

regards

Abhinav

What do you mean by ‘change’?

glut will call your render function when

  • your application gets expose events
  • when it is reshaped (which triggers its own expose events, after all)

so you can safely NEVER have a glutPostRedisplay() and have your window repainted when needed.

However, if you mean yoru scene changes, then you’ll need to keep track of that yourself and only call glutPostRedisplay in your idle func if you’ve moved geometry around.

cheers,
John