texture lookup

Dear Programmers,

What is texture lookup. How to implement.

Thanks in advance

Generally speaking texture lookup is just mapping one value to another using texture. Texture lookups are used for advanced effects and depending on the effect nature texture lookup can be implemented in a whole lot different ways. So you should probably describe what you need it for.

It basically means reading a texel value and doing something mathematical with it.

In a fragment shader, you can do this

vec4 lookupvalue = texture2D(Texture0, gl_TexCoord[0].xy);

vec4 texel = texture2D(Texture1, lookupvalue.xy);

gl_FragColor = texel;

so depending on the texcoord, a lookup is made.
The lookup is being used to sample another texture. I could do whatever I want with lookupvalue.
Texture0 is being used to look for some value. It is my lookup table.