On Friday 18 January 2008, Werner Smekal wrote:
> Hi,
>
> > the usual solution to avoid such flickering is using double-buffering.
> > I am not sure if PLplot has any device drivers that support that.
>
> The wxWidgets driver does also support double buffering.
>
> Werner
>

My previous message got bounced. Let's see if this one goes through :-)

Thanks four your suggestions regarding double-buffering, Arjen, Maurice and 
Werner.

I'm using Debian Sid (kernel 2.6.23) with PLPlot 5.8.0-6. I have an IBM T42 
with ATI Mobility Radeon 9600 M10, using the open source radeon X-driver, but 
the problem is the same on my stationary machine (Debian Sid/kernel 2-6-22) 
with an NVIDIA FX5600 card using the driver from NVIDIA.

The effect of using double-buffering with the xwin driver was that it did not 
plot anything until all the for-loop iterations were finished. Then it plotted 
just the last frame. Using the TK driver gives the same result. It also only 
plots the last frame when using -db.

I have made an example program with a rotating radial line that displays a 
comparable flickering problem as my simulation, with some comments for the 
three different drivers I tried:

#include <plplot/plplot.h>
#include <cmath>

using namespace std;

int main(int argc, char *argv[]) {

double x[2], y[2]; // Coordinates to plot
x[0] = 0; y[0] = 0; // These are fixed
x[1] = 1; y[1] = 0; // Starting position

plparseopts(&argc, argv, PL_PARSE_FULL);
     
/* Driver xwin: Fast. Lots of flickering. When using -db,
the plot is black until the loop has finished. Then the
last frame in the animation appears. */
// plsdev("xwin");

/* Driver xcairo: About twice as slow as xwin, but still
fast enough for my needs. Less flickering but far from
perfect. Using -db has no effect on the amount of
flickering. */
// plsdev("xcairo");

/* Driver wxwidgets: Much slower than xcairo when not
including plsetopt("drvopt", "smooth=0"), else about as
as fast as xcairo, maybe a tad faster.
With pgclear() as below: it only plots some of the box plus
the tickmark-numbers, very flickering, with no
lines inside the plot. Only the first frame has a clearly
visible box (a different problem that is fixed using the
smooth=0 option). Using -db has no effect.
Without pgclear(): Makes a plot that filles a disk, but
very slowly compared to xwin and xcairo. -db has no
effect.

Since pgclear() doesn't work, I found I could use pgadv(0)
together with the -np option. Gives lots of flickering, more
than xcairo */
plsdev("wxwidgets");
plsetopt("drvopt", "smooth=0");

plinit();
plenv(-1, 1, -1, 1, 1, -2);
plbox("bcinst", 0, 0, "bcinst", 0, 0);
plline(2, x, y); // Plot starting position

for(int i = 0; i != 1000; ++i) {
        // New position
        x[1] = cos(double(i)/100); y[1] = sin(double(i)/100);
        // Plot
        plclear(); // Doesn't work with wxwidgets.
        //pladv(0);
        plbox("bcinst", 0, 0, "bcinst", 0, 0);
        plline(2, x, y);
}
        
plend();
return(0);
}

Best regards,
Torquil Sørensen

-------------------------------------------------------------------------
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