Color index mode

Hi, does anyone have any experience with using color index mode / lookup tables in OpenGL with cocoa?

Because I’ve been trying to get a very simple program to work for a while now and it’s the only thing tripping me up.

I think the problem I’m having is between using the LUT for specifying colours for my polygon and actually displaying it on screen.

Does anyone have a simple example program that I could look at? Thanks.

I would also be interested in people’s experience with OpenGL CLUTs.

Looking at the OpenGL Info from various cards, it looks like you can NOT get an 8 bit color buffer under X. It just isn’t supported.

There is the paletted_texture extension but this is only supported on nvidia cards, not ATI.

You can use the imaging subset’s color table functionality, or pixel_map during texture upload, but these do not appear to be hardware accelerated so they are not very useful for realtime apps (i.e. games)

As far as I know, color index mode is not supported on Mac OS X (nor can I see any reason why you’d want it :stuck_out_tongue: )

If you have a GeForce card, You can use EXT_paletted_texture, as Alex says. On Radeon 8500+ you can use ATI_text_fragment_shader to do a dependent texture lookup to emulate paletted textures. On GeForce3/4Ti+ you can use NV_texture_shader to do the same, and on Radeon 9500+/GeForce FX you can use ARB_fragment_program to do the same.

Why do you want primitive things like color palettes?

The same reason people want fragment shaders-- flexibility. Red car/green car from same texture. Palette cycling effects. Noise. Plasma. Anything you can do with a lookup table.

There are still ways to do these things in GL on pre-fragment shader cards but AFAIK they involve doing everything on the CPU and uploading a new texture, which can get expensive if you have to do it every frame.

FWIW, the only cards not on my list above are the original Radeon family – (Radeon, Radeon 7000, Radeon 7500, mobility versions). There haven’t been all that many Macs ship with these cards in 'em (mostly recent iBooks).

I’m wanting to produce different sinewave gratings between red&green or blue&yellow and need to set up the colours to very specific values (taking into account the specific gamma properties of the monitor) so a LUT would be the easiest way to read in these values. Hmmm… need to find out which computer I’ll be displaying it on then… It’ll probably be one of the new G5s…

Well, I didn’t understand that

But all the G5s have ARB_fragment_program-capable cards, so that’s probably your best bet. Doing a dependent texture lookup is very easy, and the solution will continue to work on all new cards.

Just FYI, re: paletted textures, this thread discusses the extension being dropped from the PC drivers for the GF FX and the related hardware reasons.

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.