The ofSetBackgroundAuto(false) for not clearing the screen for each draw, doesn’t seem to work on the Raspberry Pi. It is working fine on the Mac, but when I try the code on a Raspberry Pi, it seems to just ignore the function. Any suggestions?
I am seeing this same problem. Setting ofSetBackgroundAuto to false has no effect, but exact same code works on the Mac. Is this a known problem? are there any fixes or work arounds?
void ofApp::setup(){
ofSetBackgroundAuto(false);
ofSetFrameRate(30);
}
void ofApp::draw(){
ofFill();
for (int i = 0; i < 10; i++){
ofSetColor((int)ofRandom(0,255),(int)ofRandom(0,255),(int)ofRandom(0,255));
ofDrawRectangle(ofRandom(0,1280),ofRandom(0,720),ofRandom(10,200),ofRandom(10,200));
}
}
Also, for others having this problem and want a background that persists, I just used ofFbo to create one. So the example above would look like this:
void ofApp::setup(){
fbo.allocate(ofGetWidth(), ofGetHeight() );
ofSetFrameRate(30);
}
void ofApp::draw(){
fbo.begin(); // draw to fbo
ofFill();
for (int i = 0; i < 10; i++){
ofSetColor((int)ofRandom(0,255),(int)ofRandom(0,255),(int)ofRandom(0,255));
ofDrawRectangle(ofRandom(0,1280),ofRandom(0,720),ofRandom(10,200),ofRandom(10,200));
}
fbo.end();
fbo.draw(0,0); // then draw the fbo to screen. since it is not cleared, the stuff drawn on it persists
}