Storing color texture from gl::FboRef to a Surface


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

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.