From: Maurice L. <mj...@br...> - 2008-01-18 08:10:57
|
On Thursday, January 17, 2008 at 21:40:20 (+0100) Torquil Macdonald S=F8= rensen writes: > Hello, >=20 > I have a C++ program that simulates the movements of polygons. It ru= ns a=20 > plotting function e.g. every 100 iterations of the simulation. Why i= s it that=20 > when I use PLPLOT there is lots of flickering, but with PGPLOT it lo= oks great=20 > without any flickering? Is PGPLOT much faster than PLPLOT or am I do= ing=20 > something wrong? With plplot it is too much flickering to be able to= watch=20 > the polygons move around. I have tried setting the xwin device optio= ns=20 > nobuffering and sync, but there was no difference. >=20 > Here is a description of the code: > ... The xwin device with double buffering set (-db from the command line) s= hould do the trick. Do not use sync, that slows the processing of commands b= y 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 t= icks & axis labels moving back & forth. This technique works extremely well on sufficiently simple plots, and n= ot too badly on plots of medium complexity either. To see it in action, try z= ooming & panning using the TK driver / plframe extended TK. > void new_page() { > =09plclear(); > =09plbox("bcinst", 0, 0, "bcinst", 0, 0); > } >=20 > void plot() { > =09new_page(); > =09{..calculate plot quantitie here...} > =09{... some plline() functions...} > } > =09 > int main() { > =09plsdev("xwin"); > =09plinit(); > =09plenv(xmin, xmax, ymin, ymax, 1, -2); >=20 > =09for(int i =3D 0; i !=3D i_max; ++i) { > =09=09{...simulation_code here...} > =09=09if(i % 100 =3D=3D 0) plot(); > =09} >=20 > =09plend(); > =09return(0); > } >=20 > Best regards, > Torquil S=F8rensen --=20 Maurice LeBrun |