comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » POLYFILL erases my tick values - solution?
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: POLYFILL erases my tick values - solution? [message #21961 is a reply to message #21867] Tue, 03 October 2000 00:00 Go to previous message
John-David T. Smith is currently offline  John-David T. Smith
Messages: 384
Registered: January 2000
Senior Member
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,base,/REALIZE
widget_control,self.wDraw,GET_VALUE=win ; Put *after* realizing
self.win=win
window,/FREE,/PIXMAP,XSIZE=xsize,YSIZE=ysize
self.pixwin=!D.WINDOW

;; When plotting
wset,self.pixwin ; instead of wset,self.win
erase
polyfill,blah,blah
plot,blah,blah,/NOERASE
oplot,blah,blah
polyfill, blah, blah ; and etc.
;; Two additional commands complete the double buffer
wset,self.win
device,COPY=[0,0,!D.X_SIZE,!D.Y_SIZE,0,0,self.pixwin]

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
routines/methods!

JD

--
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 |
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Named Indices
Next Topic: Complex data type

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Sun Oct 12 12:17:33 PDT 2025

Total time taken to generate the page: 2.32085 seconds