Re: Fast Draw

Steve Lamont (spl@szechuan.ucsd.edu)
Fri, 6 Dec 96 08:54:56 PST

To subscribers of the xforms list from spl@szechuan.ucsd.edu (Steve Lamont) :

> I see that when an expose event is sent to the canvas object the
> graphs are re-draw one after another and this is not estetically
> beatifull..... has someone suggestions for me to solve this problem,
> namely does exist a method that performs as the following:
> 1.freeze the canvas,
> 2.redraw all
> 3.unfreeze it
> using xforms library ?

There's no way to freeze a Canvas object, _per se_.

If you're drawing only with the XForms library, then I'd suggest using
a Free object rathar than a Canvas. Converting shouldn't be all that
difficult. Once you've accomplished that, you can use double
buffering on the object to draw to the back buffer and then swap. I
believe that XForms handles the drawables and swapping for you but I
won't swear to it since I've never done it.

If you're using some other graphics toolkit along with XForms (really
the only reason to use a Canvas other than for displaying raw images),
then it sort of depends upon the toolkit. I'll discuss the two with
which I'm most familiar: OpenGL/Mesa and PEX3D.

OpenGL/Mesa allow you to double buffer your drawing and then do a
buffer swap when you're done.

PEX3D does not support double buffering directly but X does either
using the X multibuffer extension (pre-X11R6.1) or the X double buffer
extension (X11R6.1). I have used the multibuffer extension and it is
buggy on some systems. I haven't used the X double buffer extension
yet so I can't report on how well it works. You can also render to an
offscreen Pixmap and swap this Pixmap to the background Pixmap of the
Canvas Window. I have done this with PEX3D and have had satisfactory
results.

spl
To unsubscribe, send the message "unsubscribe" to
xforms-request@bob.usuf2.usuhs.mil or see
http://bob.usuf2.usuhs.mil/mailserv/xforms.html