[comp.sys.sgi] Color Map

tans@dretor.dciem.dnd.ca (Sovannary Tan) (04/13/91)

	I am a new user of the Silicon Graphics Inc.'s IRIS-4D Series
workstation.  I am now having a problem in my program which displays two 
objects with different color maps on the screen.  The two objects 
have to be in the same viewport.  I use the command 'setmap' before I draw
each of the objects.  However, probably because setmap is only available
in immediate mode,  the whole picture changes to the colour map that
has been set by the most recent 'setmap' command.

	I need to know the solution for this problem as soon as
possible.  Your help will be greatly appreciated.

	Thanks for your attention.

Sovannary 

************************************************************************
						DCIEM
						1133 SHEPPARD AVE. W.
						P.O.BOX 2000,
						North York, Ont.
						Canada
						M3M 3B9
						(416) 635-2000
************************************************************************

kurt@cashew.asd.sgi.com (Kurt Akeley) (04/15/91)

In article <4206@dciem.dciem.dnd.ca>, tans@dretor.dciem.dnd.ca (Sovannary Tan) writes:

|> 	I am a new user of the Silicon Graphics Inc.'s IRIS-4D Series
|> workstation.  I am now having a problem in my program which displays two 
|> objects with different color maps on the screen.  The two objects 
|> have to be in the same viewport.  I use the command 'setmap' before I draw
|> each of the objects.  However, probably because setmap is only available
|> in immediate mode,  the whole picture changes to the colour map that
|> has been set by the most recent 'setmap' command.

Since color maps modify pixel colors as the pixels are displayed, rather than
as they are drawn, they are associated with windows, not with geometry.  Hence
you will not be able to display two objects in the same window with different
color maps.  You can, however, partition a single color map into multiple
submaps, and assign submaps to individual objects in a scene.  This partitioning
can allocate an arbitrary number of entries to each object, so long as the
maximum number of entries available on the system is not exceeded.  (Most IRIS-4D
products support 4096 entries (12-bit map).  Some Personal Iris models support
only 256 entries in single-buffer mode, and only 16 entries in double-buffer
mode.)  For example, you could use indexes 256 through 511 of the 4096 entry
color map for one object, and indexes 512 through 767 for another.

The multi-map facility partitions the 12-bit color map into 16 8-bit color maps,
any *one* of which can be attached to a window at a time.  Thus windows can each
select a single map at a time, and a single window can sequence through different
maps over time, but no window can use more than one map at a time.

-- kurt