I have a problem which seems to reoccur in multiple projects using GL with GLUT.
I call my Display callback as often as possible to do animation, and even when Display contains the smallest possible drawing code (eg glDrawPixels with a one by one rectangle, or a glBegin/glEnd routine with only one polygon), the Display call seems to wait until the next screen refresh until it returns control (I did some timing, and the Display call lasts about 1/120 second on average, with a range anywhere from almost 0 to about 1/60 second, thus I think it must be waiting for the refresh). I’m working on a Solaris machine, but have observed similar behavior on WinNT. Is there any way around this – can I get Display to return earlier, or can I synchronize it with the screen refresh? I realize I could run the Display in a separate thread, but I only want to try that as a last resort.
Currently, half my CPU cycles are going to Display, and 95% of those seem to be just waiting for the refresh.
Thanks for any suggestions,