Port to ofFbo from ofxFBOTexture, different behaviour

Hi,
I can’t manage to get this working on v007 with ofFbo, while it was working perfectly with v006 and ofxFBOTexture. I would like to have the content of the FBO copied in the image, but all I get in the image are some blurry pixels. You can see the difference in the two images I’ve attached.
In the setup method I do the following:

// allocate fbo and image
ofFbo texture;
ofImage image;
texture.allocate(305, 20);
image.allocate(305,20, OF_IMAGE_COLOR_ALPHA);

texture.begin();
ofSetColor(255, 255, 255, 0);
ofRect(0,0,305,20);
ofSetColor(0);
ofLine(0,10,300,10);
texture.end();
// this now used with ofFbo
texture.readToPixels(image.getPixelsRef());
// while this was used with ofxFBOTexture
image.setFromPixels((unsigned char*)texture.getPixels(),305,20, OF_IMAGE_COLOR_ALPHA);

in the draw() method:

ofEnableAlphaBlending();
image.draw(0, 50);
texture.draw(0, 100, 305, 20);
ofDisableAlphaBlending();

Does anybody have a clue on how to have the correct behavior using ofFBO? Thank you

have you tried calling update on the image after setting the pixels? The setFromPixels method updates the texture internally but the getPixelsRef() doesn’t

Thanks Arturo, that did the trick!