Storing color texture from gl::FboRef to a Surface

Hello,

Could someone kindly provide an example on how to store the texture from a FboRef type variable onto a Surface variable? The goal is to be able to read the pixel values on the FboRef by iterating through the pixels. It seems like a Surface should let me do that if I can load the texture of the FboRef on the Surface. Any suggestions would be highly appreciated. Thanks and regards.

This post from the old forum has a few good, still relevant pointers https://forum.libcinder.org/topic/move-fbo-image-data-from-gpu-to-a-ci-surface

Hello, found the solution.

mFboRefTexture = mFboRef->getColorTexture() ; 

Surface mySurface = mFboRefTexture->readPixels8u(mFboRef->getBounds());

Yep that should do it. There are also similar methods directly on gl::Fbo.

cheers,
Rich