Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!wuarchive!emory!gatech!prism!shangri-la.gatech.edu From: robert@shangri-la.gatech.edu (Robert Viduya) Newsgroups: comp.windows.x Subject: fast, flicker-free animation, how? Message-ID: <16223@hydra.gatech.EDU> Date: 1 Nov 90 18:42:26 GMT Sender: news@prism.gatech.EDU Organization: Office of Information Technology, Georgia Tech Lines: 39 I'm working on a program that animates some simple geometric entities and displays them in a window and I'm having trouble getting X to update quickly. The environment is a Sun SparcStation I with a cg3 (8-bit plain framebuffer) running OpenWindows 2.0. 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. This is the fastest and I get about 14 frames per second. However, because of the clearing and redrawing, the window flickers rather annoyingly. 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. Split the 8-bit deep window into two overlapped 4-bit deep buffers and create two colormaps; the first displays the first 4-bit deep buffer and maps the second to the background color and the second colormap displays the second 4-bit deep buffer and maps the first to the background color. To draw an image, first load the colormap that displays the buffer you are NOT going to draw into, then set the gc planemasks to the buffer your are going to draw into. When done, swap the colormaps and planemasks. This produced about 6 frames per second with the annoying side effect of causing all other windows on the X screen to flicker like crazy because of the colormap switching. It may have worked even faster if the window manager wasn't involved (the window manager is the program who's responsible for installing colormaps into the server, X clients submit requests to the window manager to have their colormaps installed). Has anyone got any other techniques to try? robert -- Robert Viduya robert@shangri-la.gatech.edu Technical Services / Office of Information Technology Georgia Institute of Technology (404) 894-6296 Atlanta, Georgia 30332-0275