swarm-support
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: ***event raised for warning...in Heatbugs


From: Sven N. Thommesen
Subject: Re: ***event raised for warning...in Heatbugs
Date: Fri, 08 Aug 1997 14:55:02 -0500

At 01:54 PM 8/8/97 -0400, you wrote:
>All,
>I have been trying to implement an additional space called "HappySpace"
>which is similar to heatspace, except that instead of heat it shows
>happiness values.  I think I have a pretty close estimation of how to do
>this, but when I run, I get an "warning" and the Happyspace window is
>all Black.
>The warning is:
>***event rasied for warning: Resource Availability 
>Problem allocating color #0000d6 substituting white 
>***execution continuing
>
>I might get it several times...
>I think I know what it is but I wanted to run it by you guys and see if
>I could be right...Could it be that Linux can't display more than 64
>colors?  Im running Redhat 4.1, with X386free XWindows.  My video card
>is 4 meg.  If this sounds right, can anyone tell me how to change the
>color settings in Redhat Linux 4.1?
>
>But, if you think it might be something in the code, the critical code
>snipets follow:
>
>In ObserverSwarm.m
>
>I add to the colormap:
>for (i=0;i<20;i++)
>[colormap setColor: i+66 ToRed: 0 Green: 0 Blue: (double)i /19.0];
>
>//since colormap (0 - 63) is reds, (64) is green, and (65) is white, 
>//I planned to have (66-86) be blues.
>
>**********Possible Problem area*********:
>
>In:
>[happyDisplay setDisplayMappingM: ???? C: ?????];  I think C: should be
>66, but I've tried all sorts of things in M: including (with reasoning):
>
>M = 1 - Since there are 20 shades of Blue, and only 20 possible
>happyValues (I converted them to integers, in heatbug.m)  It would be a
>1 to 1 relationship.  Unlike Reds, which converts 32768 to 64 shades.
>
>M = 1638 - if you divide 32768(total number of colors?) / 64(total
>number of reds wanted) = 512(number in the other setDisplayMappingM:C:),
>so 32768/20 = 1638.4.
>
>Others which seem less clear why I tried them... 0, 2, 100, 50, 512.
>
>In buildActions:
>
>I added: (after the other displayActions...)
>[displayActions createActionTo: happyDisplay message: M:(display)];
>[displayActions createActionTo: happyRaster message: M:(drawSelf)];
>
>The rest of the code for creation of the Happy Window, etc, is exactly
>like heatSpace stuff.
>
>Anyone have any ideas?
>
>Thanks,
>Brad.

Yes, I do, though they may or may not be helpful. What you are seeing is a
result of the peculiarities of how X-windows handles colors. If you are
running in 256-color (8-bit) mode, X keeps a color map with 256 slots in
it, mapping from all possible colors (24 bits per color) to the 256
different colors you can display at one time. Unless your program allocates
itself a 'private color map', which standard Swarm programs do not (but
perhaps recent hacks do?), your Swarm program has to compete with other
running programs for slots in that color map. When you run out, the result
is the error messages you got.

One way out: close other running programs before running Swarm. Netscape is
a notorious colormap hog, and earlier versions of Redhat's little program
manager bar likewise.

Another way out: figure out how to make your app use a 'private color map'
(I don't know how).

Final way out: go to truecolor. Get enough memory for your graphics card to
run the desired resolutions at 24bpp. [You need 8Mb for 1600x1200 @24bpp.]
Then X-windows does not need the colormap.

Good luck,
Sven


                  ==================================
   Swarm-Support is for discussion of the technical details of the day
   to day usage of Swarm.  For list administration needs (esp.
   [un]subscribing), please send a message to <address@hidden>
   with "help" in the body of the message.
                  ==================================


reply via email to

[Prev in Thread] Current Thread [Next in Thread]