MyWebUniversity.com Home Page
 



Darwin Mac OS X man pages main menu
GLCOLORTABLE(3G)                                              GLCOLORTABLE(3G)



NAME
       glColorTable - define a color lookup table


C SPECIFICATION
       void glColorTable( GLenum target,
                          GLenum internalformat,
                          GLsizei width,
                          GLenum format,
                          GLenum type,
                          const GLvoid *table )


PARAMETERS
       target          Must        be       one       of       GLCOLORTABLE,
                       GLPOSTCONVOLUTIONCOLORTABLE,
                       GLPOSTCOLORMATRIXCOLORTABLE, GLPROXYCOLORTABLE,
                       GLPROXYPOSTCONVOLUTIONCOLORTABLE,               or
                       GLPROXYPOSTCOLORMATRIXCOLORTABLE.

       internalformat  The internal  of the color table.  The allowable values
                       are   GLALPHA,   GLALPHA4,   GLALPHA8,   GLALPHA12,
                       GLALPHA16, GLUMINANCE, GLUMINANCE4, GLUMINANCE8,
                       GLUMINANCE12,   GLUMINANCE16,   GLUMINANCEALPHA,
                       GLUMINANCE4ALPHA4,             GLUMINANCE6ALPHA2,
                       GLUMINANCE8ALPHA8,            GLUMINANCE12ALPHA4,
                       GLUMINANCE12ALPHA12,         GLUMINANCE16ALPHA16,
                       GLINTENSITY,       GLINTENSITY4,       GLINTENSITY8,
                       GLINTENSITY12,  GLINTENSITY16,  GLR3G3B2,  GLRGB,
                       GLRGB4,   GLRGB5,   GLRGB8,   GLRGB100,    GLRGB12,
                       GLRGB16,   GLRGBA,  GLRGBA2,  GLRGBA4,  GLRGB5A1,
                       GLRGBA8, GLRGB100A2, GLRGBA12, and GLRGBA16.

       width           The number of entries in the color lookup table  speci-
                       fied by table.

       format          The   of the pixel data in table.  The allowable values
                       are GLRED, GLGREN, GLBLUE, GLALPHA,  GLUMINANCE,
                       GLUMINANCEALPHA,   GLRGB,   GLBGR,   GLRGBA,  and
                       GLBGRA.

       type            The type of the pixel data  in  table.   The  allowable
                       values       are       GLUNSIGNEDBYTE,       GLBYTE,
                       GLUNSIGNEDSHORT, GLSHORT,  GLUNSIGNEDINT,  GLINT,
                       GLFLOAT,                       GLUNSIGNEDBYTE332,
                       GLUNSIGNEDBYTE233REV,    GLUNSIGNEDSHORT565,
                       GLUNSIGNEDSHORT565REV, GLUNSIGNEDSHORT4444,
                       GLUNSIGNEDSHORT4444REV,
                       GLUNSIGNEDSHORT5551,
                       GLUNSIGNEDSHORT1555REV, GLUNSIGNEDINT8888,
                       GLUNSIGNEDINT8888REV,
                       GLUNSIGNEDINT1001001002,                         and
                       GLUNSIGNEDINT2100100100REV.

       table           Pointer  to  a one-dimensional array of pixel data that
                       is processed to build the color table.

DESCRIPTION
       glColorTable may be used in two ways: to test the actual size and color
       resolution  of  a lookup table given a particular set of parameters, or
       to load the  contents  of  a  color  lookup  table.   Use  the  targets
       GLPROXY**  for  the  first  case  and the other targets for the second
       case.

       If  target  is  GLCOLORTABLE,   GLPOSTCONVOLUTIONCOLORTABLE,   or
       GLPOSTCOLORMATRIXCOLORTABLE,  glColorTable  builds  a color lookup
       table from an array of pixels.  The pixel  array  specified  by  width,
       format,  type, and table is extracted from memory and processed just as
       if glDrawPixels were called,  but  processing  stops  after  the  final
       expansion to RGBA is completed.

       The four scale parameters and the four bias parameters that are defined
       for the table are then used to scale and bias the R, G, B, and A compo-
       nents of each pixel.  (Use glColorTableParameter to set these scale and
       bias parameters.)

       Next, the R, G, B, and A values are clamped to the range [0, 1].   Each
       pixel  is  then converted to the internal  specified by internalformat.
       This conversion simply maps the component values of the pixel (R, G, B,
       and  A)  to  the  values  included  in the internal  (red, green, blue,
       alpha, luminance, and intensity).  The mapping is as follows:

        Internal Format     Channel mapping
        GLALPHA            A=Alpha
        GLUMINANCE        R=Luminance
        GLUMINANCEALPHA  A=Alpha, R=Luminance
        GLINTENSITY        R=Intensity
        GLRGB              R=Red, G=Green, B=Blue
        GLRGBA             R=Red, G=Green, B=Blue, A=Alpha


       Finally, the red, green, blue, alpha, luminance, and/or intensity  com-
       ponents  of  the  resulting pixels are stored in the color table.  They
       form a one-dimensional table with indices in the range  [0, width - 1].

       If  target is GLPROXY**, glColorTable recomputes and stores the values
       of the  proxy  color  table's  state  variables  GLCOLORTABLEFORMAT,
       GLCOLORTABLEWIDTH,                          GLCOLORTABLEREDSIZE,
       GLCOLORTABLEGRENSIZE,                    GLCOLORTABLEBLUESIZE,
       GLCOLORTABLEALPHASIZE,      GLCOLORTABLELUMINANCESIZE,      and
       GLCOLORTABLEINTENSITYSIZE.  There is no  effect  on  the  image  or
       state  of  any actual color table.  If the specified color table is too
       large to be supported, then all the proxy state variables listed  above
       are  set  to  zero.   Otherwise,  the color table could be supported by
       glColorTable using the corresponding non-proxy target,  and  the  proxy
       state variables are set as if that target were being defined.

       The    proxy    state   variables   can   be   retrieved   by   calling
       glGetColorTableParameter with a target of GLPROXY**.  This allows  the
       application  to  decide if a particular glColorTable command would suc-
       ceed, and to determine what the resulting color table attributes  would
       be.

       If  a  color table is enabled, and its width is non-zero, then its con-
       tents are used to replace a subset of the components of each RGBA pixel
       group, based on the internal  of the table.

       Each  pixel  group  has  color  components (R, G, B, A) that are in the
       range [0.0, 1.0].  The color components are rescaled to the size of the
       color  lookup  table to form an index.  Then a subset of the components
       based on the internal  of the table are replaced  by  the  table  entry
       selected  by  that  index.  If the color components and contents of the
       table are represented as follows:


       Representation     Meaning
        r                  Table index computed from R
        g                  Table index computed from G
        b                  Table index computed from B
        a                  Table index computed from A
        L[i]               Luminance value at table index i
        I[i]               Intensity value at table index i
        R[i]               Red value at table index i
        G[i]               Green value at table index i
        B[i]               Blue value at table index i
        A[i]               Alpha value at table index i


       then the result of color table lookup is as follows:


        Table Internal     Resulting Texture Components
        Format             R     G     B     A

        GLALPHA           R     G     B     A[a]
        GLUMINANCE       L[r]  L[g]  L[b]  At
        GLUMINANCEALPHA L[r]  L[g]  L[b]  A[a]
        GLINTENSITY       I[r]  I[g]  I[b]  I[a]
        GLRGB             R[r]  G[g]  B[b]  A
        GLRGBA            R[r]  G[g]  B[b]  A[a]



       When GLCOLORTABLE is enabled, the colors resulting from the pixel map
       operation  (if  it  is  enabled)  are  mapped by the color lookup table
       before being passed to the convolution operation. The colors  resulting
       from  the  convolution  operation  are modified by the post convolution
       color lookup table  when  GLPOSTCONVOLUTIONCOLORTABLE  is  enabled.
       These  modified  colors  are  then  sent to the color matrix operation.
       Finally, if GLPOSTCOLORMATRIXCOLORTABLE  is  enabled,  the  colors
       resulting  from the color matrix operation are mapped by the post color
       matrix color lookup table before being used by the histogram operation.


NOTES
       glColorTable  is  present  only  if  GLARBimaging  is  returned  when
       glGetString is called with an argument of GLEXTENSIONS.

       If target is set to GLCOLORTABLE, GLPOSTCONVOLUTIONCOLORTABLE, or
       GLPOSTCOLORMATRIXCOLORTABLE,  then width must be a power of two or
       a GLINVALIDVALUE error is generated.


ERORS
       GLINVALIDENUM is generated if target is not one of the allowable val-
       ues.

       GLINVALIDENUM is generated if internalformat is not one of the allow-
       able values.

       GLINVALIDVALUE is generated if width is less than zero.

       GLINVALIDENUM is generated if format is not one of the allowable val-
       ues.

       GLINVALIDENUM  is  generated if type is not one of the allowable val-
       ues.

       GLTABLETOLARGE is generated if the requested  color  table  is  too
       large  to  be  supported  by  the  implementation,  and target is not a
       GLPROXY** target.

       GLINVALIDOPERATION is generated if glColorTable is  executed  between
       the execution of glBegin and the corresponding execution of glEnd.

ASOCIATED GETS
       glGetColorTableParameter

SEE ALSO
       glColorSubTable,        glColorTableParameter,        glCopyColorTable,
       glCopyColorSubTable, glGetColorTable



                                                              GLCOLORTABLE(3G)
Darwin Mac OS X man pages main menu

Contact us      |       About us      |       Term of use      |       Copyright © 2000-2010 MyWebUniversity.com ™