ofSetBackgroundAuto(false) and flicker

Hello all!

I can’t believe this is my first post to this forum. First let me say a special thanks to all of the OF developers and the OF community for such a wonderful tool. I’m having a small bug related to some work I’m doing on the “Most Pixels Ever” OF add-on (http://code.google.com/p/mostpixelsever/).

I’m using of_preRelease_v0061_osxSL_FAT on Snow Leopard and finding that

ofSetBackgroundAuto(false);

doesn’t seem to be working as expected (when the app is run full screen).

I am running a very simple example – just drawing a circle moving across a window:

  
  
//--------------------------------------------------------------  
void testApp::setup(){  
	ofSetBackgroundAuto(false);  
	ofSetFrameRate(30);  
	x = 0;  
	y = ofGetHeight()/2;  
	ofBackground(0,0,0);  
  
  
}  
  
//--------------------------------------------------------------  
void testApp::update(){  
	x = x + 10;  
	if (x > ofGetWidth()) {  
		x = 0;  
		y += 40;  
	}  
}  
  
//--------------------------------------------------------------  
void testApp::draw(){  
	//ofBackground(0,0,0);  
	ofSetColor(255,255,255);  
	ofEllipse(x,y,24,24);  
}  
  

This works 100% fine in a 1024x768 OF_WINDOW, but flickers when my window is OF_FULLSCREEN.

Has anyone noticed a similar issue? ofSetBackgroundAuto(false); is key to the MPE add-on since we render to the screen in our own thread dependent on network messages.

Thanks!

Dan

It looks like it’s a double-buffering issue, sorta like interlacing on video. You can fix it by adding window.setGlutDisplayString(“rgb alpha double samples depth”); to your main() function:

  
  
int main() {  
    ofAppGlutWindow window;  
    window.setGlutDisplayString("rgb alpha double samples depth");  
    ofSetupOpenGL(&window, 1024,768, OF_FULLSCREEN);			// <-------- setup the GL context  
  
    // this kicks off the running of my app  
    // can be OF_WINDOW or OF_FULLSCREEN  
    // pass in width and height too:  
    ofRunApp( new testApp());  
}  
  

hi dan, and welcome :slight_smile:

what OS and graphics card are you using?

i used to have this problem under vista with an old thinkpad, but recent versions of OF have been find. maybe there’s been a regression?

So far I’ve had the issue on every Mac that I’ve tested (macbook pro, mac pro, snow leopard and leopard). But Elie’s fix did the trick. Thank you Elie!!!