[comp.windows.x] simple animation

ruderman@sbcs.sunysb.edu (David Ruderman) (10/23/90)

What is the best (smoothest, fastest) way to do some
simple animation using X11.R4 on a Sun3?

I would like to do nothing more than move 2D shapes (filled circles)
around in a window.  I have tried redrawing circles as well
as Xcopyarea,  but I am not satisfied with the jumpy movements
(you can actually see the circles or bitmaps being filled in
as the shape is moved).

Any suggestions?

--
David Ruderman                            ruderman@sbcs.sunysb.edu
Department of Computer Science                      (516) 632-7675
SUNY at Stony Brook                "The price of freedom is
Stony Brook, NY  11794-4400                    eternal vigilance."

klee@wsl.dec.com (Ken Lee) (10/23/90)

In article <1990Oct22.214447.21088@sbcs.sunysb.edu>, ruderman@sbcs.sunysb.edu (David Ruderman) writes:
|> What is the best (smoothest, fastest) way to do some
|> simple animation using X11.R4 on a Sun3?
|> 
|> I would like to do nothing more than move 2D shapes (filled circles)
|> around in a window.

If you have more than a couple of moving objects, you probably want to
do some sort of double buffering.  One way is to draw on a hidden
pixmap, then CopyArea it to the screen all at once.  Another way is to
draw everything to the screen, but play with the colormap so that only
the "interesting" parts are visible.  Finally, you could use the X11R4
double buffering extension.  See the X11R4 ico demo program for sample
code.

-- 
Ken Lee
DEC Western Software Laboratory, Palo Alto, Calif.
Internet: klee@wsl.dec.com
uucp: uunet!decwrl!klee

etaylor@wilkins.iaims.bcm.tmc.edu (Eric Taylor) (10/23/90)

There is yet another method for animation.  If you have a n-plane system
you can allocate n/2 planes for each buffer for your own kind of
double buffer.
-- 
					Eric Taylor
					Baylor College of Medicine
					etaylor@wilkins.bmc.tmc.edu
					(713) 798-3776

mouse@LARRY.MCRCIM.MCGILL.EDU (10/24/90)

> What is the best (smoothest, fastest) way to do some simple animation
> using X11.R4 on a Sun3?

Use the Multi-Buffering extension, probably.

Next choice, either draw to a pixmap and copy it onto the screen or
draw using GXxor.

If you have only a small number of different sizes of circle, you may
find that it's faster to draw the circles once, into bitmaps, and then
blit those bitmaps around instead of drawing circles all the time.  (It
amounts to finding out whether draw-filled-circle is faster than
blit-bitmap or vice versa.)

					der Mouse

			old: mcgill-vision!mouse
			new: mouse@larry.mcrcim.mcgill.edu