I’m writing an application of one dimensional and three-dimensional lookup table to image data. for somereason, I want to let the GPU to do the work instead of CPU. Can I apply this using texture lookup? Someone who has experience on this please introduce something to me, thanks very much!
As far as I know, Look Up Tables (LUTs) are just textures by a GPU point of view.
So first thing to do is find a way to get the data into a texture. This should not be a problem, especially for 1D / 2D / rect2D textures. 3D textures may be problematic since they cannot be rectangular.
Then, you have to get information from the texture. For some very simple applications you may be able to do it with the standard GL modes but I guess you will need something more sophisticated i.e. dependant texture lookups.
Those may be performed in some ways (NV_texture_shader[2,3], NV_fragment_program, ARB_fragment_program, others, I raccomand the latter two).
Now, assuming you got what you need, it’s time to process the inputs. Leaving standard GL and NV_register_combiners out, ARB_fragment_program and NV_fragment_program should be cool enough. Beware however, if the algorithm is not linear (it got ‘ifs’ in it), you will have to go for NV_fragment_program and a very costy GPU (radeon 9500, geforce fx).
I guess you know how to pull the results out. Render somewhere and read back. Doing this correctly may not be so tricky.