Path: utzoo!utgpu!watserv1!watmath!att!att!linac!pacific.mps.ohio-state.edu!zaphod.mps.ohio-state.edu!sdd.hp.com!ucsd!ucbvax!bloom-beacon!LIGHTNING.MCRCIM.MCGILL.EDU!mouse From: mouse@LIGHTNING.MCRCIM.MCGILL.EDU Newsgroups: comp.windows.x Subject: Re: fast, flicker-free animation, how? Message-ID: <9011050028.AA00369@lightning.McRCIM.McGill.EDU> Date: 5 Nov 90 00:28:17 GMT Sender: daemon@athena.mit.edu (Mr Background) Organization: The Internet Lines: 42 > I'm working on a program that animates [...]. Drawing the entities > doesn't take any significant time but getting X to display them > quickly seems to be a big stumbling block. I've tried three > different methods: > Draw directly into the window, clearing it to the background > color before starting to draw. [fast but flickers] > Draw into an offscreen pixmap and then use XCopyArea to put it > into the window. This is the slowest and I get about 4 frames > per second. It does, however, produce no annoying flicker. I hope you are being careful to clear only the bounding box of the union of the two pictures.... > Split the 8-bit deep window into two overlapped 4-bit deep > buffers and create two colormaps; Instead of using two colormaps, cut the window manager out of the loop and use just one colormap, but change its contents. I don't know whether this will help or not, but it is probably worth trying. Also, if you use few enough colors, don't make the pieces a full four bits deep - you have fewer cells to modify in the colormap if you make them shallower, like two bits (sixteen colormap cells need changing) or three bits (64 cells). If you don't need the whole colormap you can also allocate out of the default colormap instead, thereby avoiding technicolor flashing of the rest of the screen. If you can, fiddle with the GC's function and fg/bg values instead of using the plane-mask; this may speed things up (I seem to recall that using nontrivial plane-masks is often very slow). > Has anyone got any other techniques to try? Did you try the Multi-Buffering extension? (I haven't; I suspect it amounts to your second method, but it may be worth a shot.) der Mouse old: mcgill-vision!mouse new: mouse@larry.mcrcim.mcgill.edu