🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.sgi.bugs
Article #14

(Long) Reality Engine and colormap incompatibilities

#14
From: Dave Wiltzius
Date: Fri, 18 Dec 1992 06:20
89 lines
4399 bytes
The following is relevant only for IRIX 4.0 or later systems.

Within the past few weeks I posted a "bug" with the
Reality Engine regarding colormaps.  Since then, I have
sorted things out (I think!) with the help of several SGI
folks, including the SGI hotline.  The information I did
get was in pieces and so I thought I would share a brief
explanation of the problem and near solutions.  A thorough
explanation would be worthy of an online document that
interested parties could FTP since I suspect this is an
"advanced" topic of limited interest.  Please note:  I
reference the Reality Engine (RE) as the distinguishing factor
when the *real* factor is multiple hardware color maps.
Here goes (I know this is going to be longer than I had hoped).

Problem: A mixed-mode (Motif GUI with mixed-mode (GL) windows)
application running on a PI flashes when the input focus
goes between GL windows and non-GL windows.  This is
because the PI (and most SGI platforms) have only one
hardware colormap that is shared for GL and X (Motif, etc)
windows.

Solution for PI: Set GL colors using XStoreColors on the
default colormap (a different colormap could be used,
but the problems are the same).  That is, instead of
setting GL colors with "mapcolor", have the application
use XStoreColors.  This could be done be redefining the
"mapcolor" function to allocate (XAllocColorCells) and
set (XStoreColors).  Note that the allocation must allocate
all the colors that GL will eventually want to set.  Also,
you don't want to step on the colors used by Motif, etc.

Now run this application on the RE (multiple hardware
color maps).  The colors set (by XStoreColors, as
noted above) for GL do not take affect.  This is because
all GL windows have their own hardware colormap whose
colors can only be set via the "mapcolor" function in
the GL library.  The default X colormap is actually
another hardware colormap.  The former can be
viewed using the "showmap" tool.  The latter can be
viewed using the "xshowcmap" tool.  (I was incorrectly
informed by SGI that simply each application gets a different
colormap.)  Please note that the RE (multiple hardware
colormaps) neatly solves the problem that mixed-mode
applications have on other platforms:  GL code from
a pure GL application (i.e. no X, Motif, etc) can be
placed, without change, in a mixed-mode window.

So the RE *requires* that the GL window use "mapcolor".
Other SGI machines require that GL colors be set
via XStoreColor on the default colormap if flashing
is to be avoided.  Hence it is possible to write
portable code (i.e. dynamically adaptable to the
platform it is running on) only if you have access to
the sources so all "mapcolor" calls are left alone for
the RE or converted to appropriate XAllocColorCells/XStoreColor
calls.  Which is often not the case if you are using
commercial libraries (i.e. no source) based on GL.

If the application is "pure" GL (uses winopen, etc instead
of Motif), then only the GL colormap is used and of
course the colors are set only using "mapcolor".

In summary, on the RE all GL windows use the GL
hardware colormap (viewed by showmap tool).  All
X (Motif, etc) windows use the default X hardware
colormap (viewed by xshowcmap tool).

There may be a nifty solution to the problem of writing
portable, mixed-mode applications.  If a solution
exists that would let me use GL libraries for which I
do not have the source, I would be very interested in
it.

Frankly, I haven't mucked around much in graphics for
about 8 years now.  Things have changed.  Different
color maps for different windows?  Must be some fast
hardware.

SGI may have bigger problems to address, but a short
essay on colormaps in the context of Motif, GL, various
SGI hardware platforms and life would be interesting
to some of us.  Or pointers to more info.

Hope this helps.
  Dave Wiltzius
  LLNL
  wiltzius@llnl.gov
Technical Details
Message-ID: <143761@lll-winken.LLNL.GOV>
Path: arc1-ca.pugleaf.net!sparky!uunet!cs.utexas.edu!sun-barr!lll-winken!anduin!wiltzius

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!cs.utexas.edu!sun-barr!lll-winken!anduin!wiltzius
From: wiltzius@anduin.ocf.llnl.gov (Dave Wiltzius)
Newsgroups: comp.sys.sgi.bugs
Subject: (Long) Reality Engine and colormap incompatibilities
Message-ID: <143761@lll-winken.LLNL.GOV>
Date: 18 Dec 92 06:20:41 GMT
Sender: usenet@lll-winken.LLNL.GOV
Organization: Lawrence Livermore Nat'l Lab.
Lines: 90
Nntp-Posting-Host: anduin.ocf.llnl.gov