Re: XForms: XForms and GL Color Index Mode

Steve Lamont (spl@szechuan.ucsd.edu)
Tue, 25 Nov 97 07:32:47 PST

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

> I want to create a 256 color colormap for the canvas.
> I assume from the documentation that you have to use X to
> allocate the colors themselves. First I create a new colormap with
>
> newColorMap = fl_create_colormap(xvinfo, 0);
> [...]
>
> I then try to allocate the color cells using X with
>
> XAllocColorCells(fl_get_display(), newColorMap, True, NULL, 0,
> colorCells, 256);
>
> It is this X routine that always fails. ...

The problem is that even if you tell fl_create_colormap() to allocate
zero map entries, it goes ahead and allocates two entries, black and
white, so there are really only 254 free cells. [TC, this "feature"
should either be documented or removed, IMHO.]

If you really want an empty colormap, you're going to have to resort
to the Xlib call XCreateColormap() or free the color cells with
XFreeColors(). Refer to your favorite Xlib manual for details.

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/