Quantcast
Channel: beginners - openFrameworks
Viewing all articles
Browse latest Browse all 4929

Problem with FBO and ofSetColor

$
0
0

@junkman wrote:

Hello,

I have a problem understanding why this doesn't work correctly:

void ofApp::setup(){
    fbo = new ofFbo(); fbo->allocate(ofGetWidth(), ofGetHeight());
}

void ofApp::draw(){
    ofClear(127, 127, 127);

    ofSetColor(0, 255, 0);
    ofCircle(100, 100, 40);

    fbo->begin();
    ofClear(0, 0, 0);
    ofSetColor(255, 0, 0);
    ofCircle(200, 200, 40);
    fbo->end();
    fbo->draw(0, 0);
}

This is what it draws (clearly the second circle should be red):

I found a fix by wrapping the 2nd and 3rd line of draw() within a ofPushStyle() and ofPopStyle(). Now that I managed to fix it, you might ask why I'm making this thread... Well, to be completely honest I don't KNOW why it fixed it. I would like to have to some clarification.

Thanks.

Posts: 2

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 4929

Trending Articles