This is actually a really weird bug I’ve been dealing with too. Consider the following code:
class testApp : public ofBaseApp {
public:
int frameCount;
testApp() {
frameCount = 0;
}
void setup() {
ofSetBackgroundAuto(false);
ofSetFrameRate(3);
}
void update() {
}
void draw() {
if(frameCount % 3 == 0) {
ofBackground(255, 255, 255);
ofSetColor(0);
ofRect(ofRandom(0, ofGetWidth()), ofRandom(0, ofGetHeight()), 100, 100);
}
frameCount++;
}
};
You would expect it to draw a new rectangle to the screen every second, replacing the old one.
Instead, what happens varies with whether you are fullscreen or not, and (on my video card) the antialiasing settings.
Fullscreen + antialiasing is overridden to 2x or greater: works correctly.
Windowed + antialiasing is overridden to 2x or greater: draws the rectangle, then two frames of white background, then new rectangle, etc.
Windowed + antialiasing is controlled by app: same as above.
Fullscreen + antialiasing is controlled by app: draws rect1, then white frame, then rect1, then new rect2, then white, then rect2, then rect3… like there are two buffers. I’m guessing this is what the ofAppGlutWindow.cpp is referring to when it says:
// I don't know why, I need more than one frame at the start in fullscreen mode
// also, in non-fullscreen mode, windows/intel graphics, this bClearAuto just fails.
// I seem to have 2 buffers, alot of flickering
// and don't accumulate the way I expect.
// with this line: if ((bClearAuto == true) || nFrameCount < 3){
// we do nFrameCount < 3, so that the buffers are cleared at the start of the app
// or else we have video memory garbage to draw on to...