On Thursday, January 17, 2008 at 21:40:20 (+0100) Torquil Macdonald Sørensen 
writes:
 > Hello,
 > 
 > I have a C++ program that simulates the movements of polygons. It runs a 
 > plotting function e.g. every 100 iterations of the simulation. Why is it 
 > that 
 > when I use PLPLOT there is lots of flickering, but with PGPLOT it looks 
 > great 
 > without any flickering? Is PGPLOT much faster than PLPLOT or am I doing 
 > something wrong? With plplot it is too much flickering to be able to watch 
 > the polygons move around. I have tried setting the xwin device options 
 > nobuffering and sync, but there was no difference.
 > 
 > Here is a description of the code:
 > ...

The xwin device with double buffering set (-db from the command line) should
do the trick.  Do not use sync, that slows the processing of commands by the X
server way down.  Another thing to keep in mind is that the axes should remain
fixed throughout the run, else there will be flickering caused by the ticks &
axis labels moving back & forth.

This technique works extremely well on sufficiently simple plots, and not too
badly on plots of medium complexity either.  To see it in action, try zooming
& panning using the TK driver / plframe extended TK.

 > void new_page() {
 >      plclear();
 >      plbox("bcinst", 0, 0, "bcinst", 0, 0);
 > }
 > 
 > void plot() {
 >      new_page();
 >      {..calculate plot quantitie here...}
 >      {... some plline() functions...}
 > }
 >      
 > int main() {
 >      plsdev("xwin");
 >      plinit();
 >      plenv(xmin, xmax, ymin, ymax, 1, -2);
 > 
 >      for(int i = 0; i != i_max; ++i) {
 >              {...simulation_code here...}
 >              if(i % 100 == 0) plot();
 >      }
 > 
 >      plend();
 >      return(0);
 > }
 > 
 > Best regards,
 > Torquil Sørensen

-- 
Maurice LeBrun

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Plplot-general mailing list
Plplot-general@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/plplot-general

Reply via email to