View Full Version : Color index mode
demon_cock
12-12-2003, 05:16 AM
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.
arekkusu
12-12-2003, 08:41 AM
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)
OneSadCookie
12-12-2003, 12:22 PM
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 :P )
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?
arekkusu
12-12-2003, 03:12 PM
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.
OneSadCookie
12-12-2003, 06:14 PM
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).
demon_cock
12-14-2003, 12:22 PM
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....
OneSadCookie
12-14-2003, 12:36 PM
Well, I didn't understand that http://www.opengl.org/discussion_boards/ubb/smile.gif
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.
arekkusu
12-31-2003, 10:32 AM
Just FYI, re: paletted textures, this thread (http://www.opengl.org/discussion_boards/ubb/Forum3/HTML/009234.html) discusses the extension being dropped from the PC drivers for the GF FX and the related hardware reasons.
Powered by vBulletin® Version 4.2.0 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.