PDA

View Full Version : Reading FBO Texture



Hylke Donker
12-26-2006, 01:53 AM
Hello,
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.
Hylke

Zengar
12-26-2006, 12:04 PM
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...

Hylke Donker
12-27-2006, 09:57 PM
Ah ok..
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 :-)
Hykje

Pyry
12-28-2006, 01:44 AM
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.

/Pyry

Hylke Donker
12-28-2006, 09:48 AM
Wow, thanks for your reply. :-)
That's just what I needed.
Hylke

Mars_999
12-28-2006, 11:24 AM
Is glReadPixels still slow when using it with FBOs? Wouldn't using glGetTexImage be faster than a glReadPixels call?

Zengar
12-28-2006, 01:08 PM
I always thought that GetTexImage was slower then ReadPixels... Still, if you read just one pixel it should be fast enough...