From: Bob Rozumalski <roz@comet.ucar.edu>


Greetings all;


From time to time I get a question pertaining to color allocation
errors when running GEMPAK/NAWIPS/NTL programs under EXCEED, LINUX,
or HPUX.  These are all very common problems that are easily corrected.
In this treatise, I hope to clear up any confusion and provide the 
information needed to rectify problems that you may be having.


Here are two common error messages that you may have seen:

ERROR #1 - The evil "integer parameter out of range" error

roz@kielbasa-> ntl

X Error of failed request:  BadValue (integer parameter out of range for 
operation)
  Major opcode of failed request:  86 (X_AllocColorCells)
  Value in failed request:  0x0
  Serial number of failed request:  351
  Current serial number in output stream:  351


ERROR #2    - The pesky, "not enough colors" problem

roz@kielbasa-> ntl

graphic, satellite, radar -- 33 128 16
         Request total # of colors = 177
         Current available system colors = 158


Both errors are related to the number of colors that you have 
available on your LOCAL MACHINE and NOT the machine that is 
running the program.  In many cases these may be the same 
machine, such as when you are sitting down in front of the SAC, 
but not always.  For example, if you are using EXCEED import 
your SAC display to your PC, then the problem is with your PC 
and not the SAC.


ERROR #1 is due to a problem with your LOCAL SYSTEM configuration, 
while ERROR #2 is due to a USER windows configuration problems.


Troubleshooting ERROR #1

First, if you are running GNOME windows manager, switch to KDE.
NAWIPS will not run under GNOME.

This error may be generated because your LOCAL machine is 
running in 24-bit, TrueColor mode. Like it or not, GEMPAK/NAWIPS/NTL 
can only run under 8-bit PseudoColor mode so you will have to modify 
your SYSTEM windows configuration to put your LOCAL machine in 8-bit 
mode.  This is a common error under LINUX and when using EXCEED.

You can see that the you are in TrueColor mode by running the "xdpyinfo" 
command and look at the default visual information:

    roz@kielbasa-> xdpyinfo

    (NOTE: STUFF DELETED)

    name of display:    mindy.comet.ucar.edu:0.0
    version number:    11.0
    vendor string:    The XFree86 Project, Inc
    default screen number:    0
    number of screens:    1

    screen #0:
      default visual id:  0x22
      visual:
        visual id:    0x22
        class:    TrueColor               <--- NOTE TrueColor    (BAD)
        depth:    24 planes               <--- NOTE 24-bit       (BAD)

        available colormap entries:    256 per subfield
        red, green, blue masks:    0xff0000, 0xff00, 0xff
        significant bits in color specification:    8 bits


For EXCEED users, the solution is to simply set your PC to 256 colors.

For LINUX users, you will have to reconfigure your X server.  This does 
NOT require a complete installation of your OS, but is not as elegant as 
the EXCEED solution.  You may either:

    1) Run XF86Setup or Xconfigurator as root.  You will need your graphics
       card and monitor info that you used when installing the OS.  When
       it prompt you to select the colors vs resolution, make sure you choose
       values ONLY in the 8-bit (256) color listing.

    or


    2) Hack the  X configuration file. On my RH LINUX 6.0 machine that file
       is /etc/X11/XF86Config.  The very bottom of the file is where you
       define the colors.

       % cd /etc/X11/
       % cp XF86Config XF86Config.orig

       edit the XF86Config file:

--------------------------------------------------------------------------------
-
# **********************************************************************
# Screen sections
# **********************************************************************
# The Colour SVGA server

Section "Screen"
    Driver      "svga"
    Device      "Generic VGA"
    #Device      "TVP4020 Permedia 2"
    Monitor     "Dell Ultrascan 21FS"
    Subsection "Display"
        Depth       24               <-- Change to 8
        #Modes       "1280x1024"
        ViewPort    0 0
    EndSubsection
EndSection

# The accelerated servers (S3, Mach32, Mach8, 8514, P9000, AGX, W32, Mach64
# I128, and S3V)
Section "Screen"
    Driver      "accel"
    Device      "TVP4020 Permedia 2"
    Monitor     "Dell Ultrascan 21FS"
    Subsection "Display"
        Depth       24                  <-- Change to 8
        Modes       "1280x1024"
        ViewPort    0 0
    EndSubsection
EndSection

--------------------------------------------------------------------------------
----

Finally, restart your Xserver or reboot the machine.



Troubleshooting ERROR #2

Error #2 is the results of not having enough colors available in your 
local windows environment. Remember, you only start out with 256 and 
your environment requires colors. Ntl must have 177 colors available 
in order to start running, otherwise you will get the error listed above:


graphic, satellite, radar -- 33 128 16
         Request total # of colors = 177
         Current available system colors = 158

Note that of the 256 original colors, there are only 158 remaining.  
All those colors were taken up by your "window treatments" and/or other 
processes, such as netscape.

To rectify the error above, you have 2 choices:

    1) kill any other color intensive processes or reduce the amount of 
       colors require by your windows

 or

    2) Start NTL with FEWER that the 177 required colors.


Solution #2 is easy. Ntl will actually take arguments ( -g, -s, -r) that 
will allow you to request fewer than the default number of colors, which 
is 33 for GARP (Graphics), 128 for satellite, and 16 for radar.  From the 
error message above, I need to request 19 fewer colors since all I have 
available is 158.  If you know that you are not going to look at radar, 
you could  start ntl as:

    % ntl -r 0 -s 3

Here, I will be starting ntl with 0 radar colors and 3 satellite colors.

Solution #1 requires that you kill all graphic intensive processes, such as 
netscape, until AFTER ntl is running.  Afterwards, you may start netscape with 
the "-install" option, witch will initial the color map swapping between 
processes:

    % netscape -install


If that doesn't work then you will have to reduce the amount of colors used 
by your windows. On your HP, click on the style manager icon along the bottom 
of your screen:

    style manager --> Color --> Number of colors --> Most for Applications

    When you get out, you will have to log out and log back in for the changes 
    to take effect.

On LINUX Systems, this avenue depends on which of the many windows managers
you are running.


I hope this helps to clear some of the confusion.

Bob

