Flickering with ofSetBackgroundAuto

I’m getting a weird flickering issue, where it almost like there are two screen buffers that alternate instead of just the one.

Here is the entire code for a simple test:

  
//--------------------------------------------------------------  
void testApp::setup(){  
    ofSetBackgroundAuto(false);  
    ofSetFrameRate(3);  
}  
  
//--------------------------------------------------------------  
void testApp::update(){  
  
}  
  
//--------------------------------------------------------------  
void testApp::draw(){  
    ofFill();  
    ofSetColor(23, 45, 99);  
    ofRect(ofRandom(0, 400), ofRandom(0, 400), 22, 22);  
}  

So it should add a square each frame. Instead, check out what happens:

I’ve watched it at low framerates. It sometimes doesn’t happen right away - a few frames or so will go by before it starts. Then it will start the alternating. Everything acts as it should, but exactly as if it works with two alternating screen buffers.

Any ideas what’s going on? I’m using the latest download, OS X, MacBook Pro 2010, 10.6.6

i have the same. I guessed it is double buffered somewhere. It would be a total killer for me other than i don’t fully wipe my screen each frame (sort of accumulation blend effect i use often) so the effect is less. I have asked for a solution or pointer to a error but got no reply. OSX 10.6.c xcode 4 macpro 2xquad 5770 card.

Oh and of course if there are two buffers involved then this would be fine as long as the user cleared the background each frame as he/she wouldn’t motive the effect.

I worked around it by grabbing a screen image each frame, then drawing it at the beginning of the next frame. But this seems pretty wasteful for something that should be unneeded.

I have a “better?” workaround for this. change glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH | GLUT_ALPHA ); to glutInitDisplayMode(GLUT_RGB | GLUT_SINGLE | GLUT_DEPTH | GLUT_ALPHA ) in ofAppGlutWindow.cpp line 134. It makes zero frame rate difference on my app however that may be because i am CPU bound and/or filtrate bound rather than anything else. Although i don;t know how the pipeline is set up so i am just guessing here.

This works well and is rock steady for me. Glad you had the problem as it made me find a solution.

Excellent, blahblab! Works great on my end too.

Sadly, I kind of miss the flickering now. Added a nice touch to the texture of the piece…

Rather than changing the library source, you can achieve the same result with setGlutDisplayString().

In main.cpp, I added this line right before ofSetupOpenGL():

  
window.setGlutDisplayString("rgba single samples>=4 depth");  

I also had to add this command at the end of my draw() routine, or the screen didn’t update.

  
glFlush();