oh ya… I’m using the ofFBOTexture class from here: http://forum.openframeworks.cc/t/fbo-addon-for-0.06/1866/11
I’m doing some testing and I’m getting it to grab into an ofImage what I draw into the FBO… but it’s offset on the y-axis by almost half (2px less) the FBO’s height.
And also, it’s not taking it as a transparent background.
My ofFBOTexture::clear method, looks like this…
void ofFBOTexture::clear(bool transparent)
{
glClearColor(bgColor[0],bgColor[1],bgColor[2], (transparent?0.0f:bgColor[3]));
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // Clear Screen And Depth Buffer
}
And here’s my testApp::setup and draw methods.
void testApp::setup(){
ofEnableAlphaBlending();
myFBO.allocate(500, 500, false);
myFBO.clear(true);
myFBO.setupScreenForMe();
myFBO.swapIn();
ofSetColor(255, 0, 0, 127);
ofFill();
ofCircle(250, 250, 50);
ofSetColor(255, 255, 255);
myFBO.swapOut();
myFBO.setupScreenForThem();
myFBO.setupScreenForMe();
myFBO.swapIn();
grabbed.grabScreen(0, 0, 500, 500);
grabbed.setImageType(OF_IMAGE_COLOR_ALPHA);
myFBO.swapOut();
myFBO.setupScreenForThem();
}
void testApp::draw(){
ofSetColor(0, 127, 0);
ofFill();
ofRect(0, 0, ofGetWidth(), ofGetHeight());
ofSetColor(255, 255, 0);
for(int i=0; i < ofGetWidth(); i += 25)
ofLine(i, 0, i, ofGetHeight());
ofSetColor(255, 255, 255);
grabbed.draw(ofGetFrameNum(), 10);
}
The testApp doesn’t do much - basically just drawing a circle to the FBO, capturing it, then drawing the image moving across the screen.