Re: XForms: How to display real time images

Steve Lamont (spl@szechuan.ucsd.edu)
Tue, 19 May 98 06:34:17 PDT

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

> I can get 3 matrice of RGB values of real time images, how can I
> display them in xform continuously?

> Should I use fl_set_bitmap_data() or fl_set_pixmap_data()? What is
> the input data structure to them?

I'm not sure I understand your question exactly but if you mean how do
you display an image or series of image (say, an animation) in XForms,
then the Bitmap or Pixmap objects are most likely *not* what you wish
to use.

Bitmap display one-bit (depth 1) images and is only suitable for very
simple graphics such as used in icons. The data format is basically
just an array of bits stored in an array of type `unsigned char'.
These bitmaps are generally created using the X `bitmap' program.

XForms will load Xpm (X Pixmap) data or it will support directly
loading Pixmaps if you can convert your data into Pixmap form.

The Xpm format is discussed in the documentation for the Xpm library
(see <http://zenon.inria.fr/koala/lehors/xpm.html> for starters). The
Xpm data format is not really suitable for animation since it has a
large amount of interpretive overhead.

A better approach using Pixmap objects would be to create your own
Pixmaps on the fly. You could then load the Pixmaps into the server
and display them with fl_set_pixmap_pixmap(). You will have to create
the Pixmap with XCreatePixmap() and fill it using the the XPutImage()
or XPutPixel() functions. However, there is a lot of overhead in this
and it's somewhat inflexible and cumbersome. For instance, if you
desire to resize the image, zoom, or pan, then you'll have to manage
all of that yourself.

The best approach is probably to use an OpenGL Canvas object and
OpenGL or MesaGL to display your images using glDrawPixels(). OpenGL
provides facilities for resizing your images, panning, and zooming
(through the use of texture maps) as well as a large number of other
advanced functions.

Of course, if you intend to achieve real time, then you'll probably
need specialized hardware and/or a very fast processor to push the
pixels.

Hope this helps.

spl
_________________________________________________
To unsubscribe, send the message "unsubscribe" to
xforms-request@bob.usuf2.usuhs.mil or see
http://bob.usuf2.usuhs.mil/mailserv/xforms.html
XForms Home Page: http://bragg.phys.uwm.edu/xforms
List Archive: http://bob.usuf2.usuhs.mil/mailserv/list-archives/