[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: POLYFILL erases my tick values - solution?
Craig Markwardt wrote:
> You could re-render the entire thing in an off-screen pixmap, and then
> dump the pixmap to the screen (or at least the relevant portion). I
> believe this would be a classic example of so-called double buffering
> in computer graphics.
Double Buffering was definitely a good idea, Craig. It was very simple
to implement and is much faster than I would have expected. In fact, it
worked well enough that I think David should add it to his book as a
technique to avoid flashing displays in the case that you can't simply
save and device,COPY the relevant part of your graphics output. It
seems to work especially well in the context of plotting. If you want
to rapidly redisplay a plot with moving/changing parts and multiple
display commands being invoked, this technique is definitely for you!
Flicker free performance.
Here's the synopsis:
;; Standard widget_draw/pixwin setup, in an Init function maybe
widget_control,self.wDraw,GET_VALUE=win ; Put *after* realizing
;; When plotting
wset,self.pixwin ; instead of wset,self.win
polyfill, blah, blah ; and etc.
;; Two additional commands complete the double buffer
This is really just the same idea (though easier!) as the normal image
buffering techniques typified by the "rubber band" example we all know
and love, but with the seemingly costly step of re-displaying each and
every time through, rather than saving a fixed image for copying. It
does make a *big* difference in the smoothness of moving plots, and
really takes only 2 additional lines surrounding your plot code (plus
getting the pixwin in the first place).
Also, don't forget to free those pixwins in your cleanup
J.D. Smith | WORK: (607) 255-6263
Cornell Dept. of Astronomy | (607) 255-5842
304 Space Sciences Bldg. | FAX: (607) 255-5875
Ithaca, NY 14853 |