Hey all,
I’m having a bit of trouble with ofFbo. What I’m trying to do is grab a frame from my webcam and then distort it with some procedurally generated textures. I’m currently tackling this by a) grabbing a frame from the webcam and storing into into a texture, b) using an ofFbo to draw up a texture ‘offscreen,’ and then c) would be blending/combining the webcam texture with the fbo. But I can’t seem to get past step b successfully. If I try to draw to the fbo offscreen, I end up drawing to the screen somehow.
Here’s a snippet of code that causes trouble:
void createTestPattern() {
testfbo.allocate(width, height, GL_RGBA);
testfbo.begin();
ofClear(0, 0, 0, 0);
ofSetColor(255, 0, 0, 255);
ofCircle(width/2, height/2, 100);
testfbo.end();
}
void draw() {
ofBackground(ofColor::white);
// Draw ONLY the webcam texture
webcamTexture.draw(0,0);
}
If I run the createTestPattern() function, the webcam texture becomes tinted red when drawn even though I haven’t drawn the fbo to the screen.
The code in more context is on github: https://github.com/mikewesthad/hypersensitive.