I would like to know what the color of a perticular pixel from a texture is. Obviously this isn’t a ‘regular’ static texure, but a texture from a Frame Buffer Object.
But is there a way to do this, except for using shaders(because they can directly read from textures if i’m correct)? I would like to keep the shaders-way as a last resort.
FBO Textures are the same as regular textures from the OpenGL point of view. You could read the texture image back to the main memory, or just texture a polygon with the texel you want it and read the pixel color back…
So if I want to access 2 or 3 pixels, I need to copy the whole texture back to my main RAM?
In that case, i’m gonna first try to do it with shaders.
Anyway, thanks for your help
If the textures are bound to FBO’s, you can always bind the FBO’s one at a time and use glReadPixels to read the pixel (=texel) values from there. That way you won’t need to copy the whole texture image back to the client memory.
Wow, thanks for your reply.
That’s just what I needed.
Is glReadPixels still slow when using it with FBOs? Wouldn’t using glGetTexImage be faster than a glReadPixels call?
I always thought that GetTexImage was slower then ReadPixels… Still, if you read just one pixel it should be fast enough…