[comp.windows.x] Fast Updates

mike@atc.SP.Unisys.COM (Mike Grenier) (05/18/91)

We are trying to bring up an Air Traffic Control display on
an X window terminal and there seems to be some problems.

An individual track (entity) on the screen may move at any time and
they more overlap other tracks. One approach would be to use XOR when
updating so one does not have to regenerate the entire screen when an
object moves but that approach leaves holes where the lines cross.

Another approach would be to use double buffering but the box being
used doesn't have the CPU power to regenerate the screen every half
second or so.

Under the TIGA library on the PC, we could use the ADD function instead
of an XOR which cause the resulting 8-bit deep pixel to be set to 
current value (say showing part of one entity) + the new pixel value
of the new entity. Normally this would result in a different color 
but in our case the color map is set up so that anything over say
10 would be green and the pixel value minus 10 would represent the 
number of lines layered on this pixel location. When moving an object,
one would use the corresponding SUBTRACT function and redraw the objects
current position followed by and ADD in the new position. This works 
great until one gets over 255 - 10 lines crossing on a given pixel 
but in general this is not a problem.

Does anyone have any good ideas for updating these objects on an X
screen short of double buffering?

   -Mike Grenier
    mike@sp.unisys.com

klee@wsl.dec.com (Ken Lee) (05/18/91)

In article <1991May17.220145.22765@atc.SP.Unisys.COM>, mike@atc.SP.Unisys.COM (Mike Grenier) writes:
|> An individual track (entity) on the screen may move at any time and
|> they more overlap other tracks.

If you have a free color plane or 2, you can do your overlays there.
This is pretty fast and is generally more robust than XOR-based
algorithms.  If you have more than one track to overlay, you can
put them each in a different plane or your can XOR them.

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

tomt@maui.coral.COM (Tom Tulinsky) (05/18/91)

) 
) We are trying to bring up an Air Traffic Control display on
) an X window terminal and there seems to be some problems.
) 
) An individual track (entity) on the screen may move at any time and
) they more overlap other tracks. One approach would be to use XOR when
) updating so one does not have to regenerate the entire screen when an
) object moves but that approach leaves holes where the lines cross.
) 
) Another approach would be to use double buffering but the box being
) used doesn't have the CPU power to regenerate the screen every half
) second or so.
) 

Try this.  Figure out a rectangle that encloses the whole track.  Use
XSetClipRectangles to clip drawing to two rectangle enclosing the old
position and the new position.  Clear the window (only the area in the
rectangles will be cleared) and redraw the whole window with the new
positions.  Since only a small part of the window is actually drawn
to, it is much faster and flickers much less.  The server is pretty
fast at throwing away clipped graphics commands.  

Arbitrary polygons can also be used for clipping with XPolygonRegion.

I'd be interested to know how you solve this problem.


 Coral
     * **	Tom Tulinsky                508 460-6010
  *  **		Coral Network Corporation   fax 508 481-6258
*  ** 		734 Forest St               net: tomt@coral.com
 ***		   Marlboro, MA 01752		
  **		   U S A
*********	   Overheard in a BART station:
NETWORKS	      "I was the only NORM there!"

ron@uts.amdahl.com (Ron Hughes) (05/21/91)

In article <1991May17.220145.22765@atc.SP.Unisys.COM> mike@atc.SP.Unisys.COM (Mike Grenier) writes:
>
>We are trying to bring up an Air Traffic Control display on
>an X window terminal and there seems to be some problems.

Oh God.  I think I'm gonna start taking trains.

Ron

SAVCHENKO@cgi.COM (Alex Savchenko) (05/21/91)

In-Reply-To: Mike Grenier's message of Fri, 17 May 1991 22:01:45 GMT
 <1991May17.220145.22765@atc.SP.Unisys.COM>



) 
) We are trying to bring up an Air Traffic Control display on
) an X window terminal and there seems to be some problems.
) 
) An individual track (entity) on the screen may move at any time and
) they more overlap other tracks. One approach would be to use XOR when
) updating so one does not have to regenerate the entire screen when an
) object moves but that approach leaves holes where the lines cross.
) 
) Another approach would be to use double buffering but the box being
) used doesn't have the CPU power to regenerate the screen every half
) second or so.
) 

You may also try to play with dynamic modification of colormap to minimize
flicker by allocating several bit planes (in general case: color planes) to 
keep sequence of frames and clearing them all when you run out of planes.

here's scenario for 3 frame buffering:

Initial colormap
	b: 000X - bicolor background
	f1:001X - frame1 color
	f2:01XX - frame2 color
	f3:1XXX	- frame3 color	

Initial State:
	Everything set to b;

Drawing:
	1. Draw frame1 with f1 (frame1 color != bicolor background)
	2. Modify Color(f1) = Color(b); Draw frame2 with f2;
	3. Modify Color(f2) = Color(b); Draw frame3 with f3;
	5. Erase with bit mask 111X, reset Color(f1), Color(f2)
	6. Repeat from 1.

Alex.

Carnegie Group Inc.,
Pittsburgh, PA
e-mail: savchenk@cgi.com