PDA

View Full Version : texture lookup



iris_raj
12-04-2006, 09:43 PM
Dear Programmers,

What is texture lookup. How to implement.

Thanks in advance
RAJESH.R

k_szczech
12-05-2006, 02:16 AM
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.

V-man
12-09-2006, 02:01 PM
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.