How to save an ofFBO to an image on disk?

Hello all.

I’m currently building an application that uses a rendering pipeline that results in an FBO. I’m using the ofFbo container class to achieve this. Once the rendering completes, I want to save the contents of the FBO to disk analogous to as if I was saving a screenshot of the window to an image file.

How would I go about doing this?

Hi there!

You can use ofFbo::readToPixels to get the pixels from an ofFbo and store it in an ofPixels instance. And save it to the disk from there.

If you want something a bit more complex, but suited for more demanding situations, check the example in gl/threadedPixelBufferExample.

1 Like

Hi @hubris!

Thanks for the info, it’s exactly what I needed. :smile: