Heriberto Delgado wrote:
>
> I have a question about color index management. In all the books I've read about
> GL, there is NO definition of how RGB colors must be distributed across color
>indexes;
> apparently, it's implementation-dependent. However, if we look at the Palm, we'll
>see it
> has a "white" screen (by now, it's green, but the soon-to-come Color Palm will have
>it
> white), and the pixels written to the screen are black, in contraposition with most
>PC video
> screens. GL's reference manual says that the default clear color (the one specified
>with
> glClearColor() ) for RGB windows is (0,0,0), and for color index windows, it must be
>0. So
> this ends up in we have a default clear color of "black" for RGB windows, but a
>"white"
> (color 0) color for color index windows in the Palm! I perfectly understand one
>thing is the
> standard, and another thing (sometimes very different) is what people actually do.
>So, my
> question: Should I use the color indexes that the Palm uses now (0 = white, max =
>black), or
> should I remap these indexes to obtain a closer match to the current implementations
>of GL,
> including Mesa?
In OpenGL the default glClearIndex is zero but that does not imply any
particular color such as black or white.
If your color table/palette is fixed (ala X's StaticColor visual) then
it's up to you (or the OS) to scan the table for the desired color and
use the corresponding index for clearing.
If your color table isn't fixed but shared with other clients then
typically you have to request a read-only or read/write table entry from
the window manager.
So on the color Palm for example, if you want a white background you'll
probably have to ask the Palm OS for the white color index.
The bottom line is: don't hard-code your color indexes. Cooperate with
the OS or window system's color table allocator.
A color-index OpenGL app which assumes index 0 is black (or white) is
broken.
-Brian
_______________________________________________
Mesa-dev maillist - [EMAIL PROTECTED]
http://lists.mesa3d.org/mailman/listinfo/mesa-dev