Monday, July 21 2003 @ 12:41 PM UTC
Contributed by: witness
Does your drawing code draw lots'a stuff, but nothing shows up on screen? Does your animation only show its last frame, and none of the intermediate steps? Chances are, you forgot to flush.
Very likely, you forgot to flush your window buffer. On MacOS X, windows are buffered. That means MacOS X records all your drawings, but only displays the changed contents on screen when all drawing has finished. This minimizes the "stacking" and "flashing" effects you sometimes get when drawing overlapping objects.
But since MacOS X can not know when you are finished drawing, it simply applies drawings whenever you return control to MacOS after processing an event. Most of the time this is right, but if you're trying to do animations and effects, you have to explicitly tell the OS that you really want it to redraw your stuff now. To achieve that, you call QDFlushPortBuffer() or CGContextFlush().