next up previous contents index
Next: Stencil Index Lookup Up: 3.6.4 Pixel Transfer Operations Previous: RGBA to RGBA

Color Index Lookup

This step applies only to color index groups. If the GL command that invokes the pixel transfer operation requires that RGBA component pixel groups be generated, then a conversion is performed at this step. RGBA component pixel groups are required if

  1. The groups will be rasterized, and the GL is in RGBA mode, or
  2. The groups will be loaded as an image into texture memory, or
  3. The groups will be returned to client memory with a format other than COLOR_INDEX.
If RGBA component groups are required, then the integer part of the index is used to reference 4 tables of color components: PIXEL_MAP_I_TO_R, PIXEL_MAP_I_TO_G, PIXEL_MAP_I_TO_B, and PIXEL_MAP_I_TO_A. Each of these tables must have entries for some integer value of n (n may be different for each table). For each table, the index is first rounded to the nearest integer; the result is ANDed with , and the resulting value used as an address into the table. The indexed value becomes an R, G, B, or A value, as appropriate. The group of four elements so obtained replaces the index, changing the group's type to RGBA component.

If RGBA component groups are not required, and if MAP_COLOR is enabled, then the index is looked up in the PIXEL_MAP_I_TO_I table (otherwise, the index is not looked up). Again, the table must have entries for some integer n, and the integer part of the index is ANDed with , producing a value. This value addresses the table, and the value in the table replaces the index. The floating-point table value is first rounded to a fixed-point value with unspecified precision. The group's type remains color index.

David Blythe
Sat Mar 29 02:23:21 PST 1997