extract RBG color value from texture

knowing the texture coord (U,V) is it possible to get the RGB value at that point in a texture?

cheers
ms

can’t you just convert the scalars into pixel locations on the image and read that?

I guess if you no longer have the image in system memory you could use glTexSubImage2D() to sample a 1x1 area of the origional.

>>I guess if you no longer have the image in system memory you could use glTexSubImage2D() to sample a 1x1 area of the origional.

Huh? glTexSubImage2D downloads a texture.
You mean, draw a textured quad with GL_NEAREST filtering and texture coordinates (u,v) to (u,v) (maybe plus 1/2 texel) and check the color onscreen.

glGetTexImage is the correct call to readout a downloaded texture, but I haven’t ever seen an app using that. Supposedly slooow.

Converting a UV coordinate into a 2D point is pretty easy (put the UV into the range [0,1] and just multiply by the resolution of the texture).

I would suggest that, if you frequently need access to the texture (either to read or write), don’t delete the texture you pass to glTexture2D. Keep it around and, if you change the data, make another call to glTexture2D.

Rather similar to shadowing OpenGL functions.

glGetTexImage( … )