Reading a FrameBuffer with RGBA32F format into a float array

Hello all,

I’m writing a program that will generate a scene, render it to an RGBA32F offscreen buffer, then get the float data in an array to do further analysis.



The problem is, I can’t figure out how to read the content of a float frame buffer. Renderer.readFrameBuffer only supports RGBA8. I tried modifying the source to use GL_FLOAT in a readFloatFrameBuffer method, but it seems that I need to do many other changes to complete this… (kinda out of my league :stuck_out_tongue: )



I also tried using an RGBA32F texture in the offscreen framebuffer, but I guess that the rendered texture remains in gpu memory and I can’t retrieve it. (texture.getImage().getData(0) always contains zeros)…



I hope that makes sense…



Thank you!

So with a RGBA8 it works? (as a starter question)

yes. RGBA8 works when I use Renderer.readFrameBuffer… (but not when using a texture… I think I don’t have full understanding of how data in textures is updated in render-to-texture case)

Well I can help you with that.

Texture is basically just a id, with data attached. Instead of using the data in ram and uploading it to gpu however the gpu writes with the framebuffer into it. (so when using the id the gpu knows the right data, however the data is never downloaded to ram.) (thats what the readFrameBuffer does)

1 Like

Thank you! That was helpful.

So I guess the only solution then is to modify the source to support RGBA32F.