Flickering animation

Hey all,

I am brand new to OF. I have been using Processing for some time now and I am finally deciding to explore other stuff. Anyway, I made a simple bouncing ball application

http://datasingularity.com/misc/graphicsExample.zip

using XCode. Pretty easy, everything compiles and runs fine, but, the animation is not very smooth. I tried different frame rates and still jitters about every 30 frames or so. My initial guess is that this has something to do with OpenGL. I think I resolved this in Processing by calling JOGL’s setSwapInterval(1); ? I can’t remember. Anyway, if anyone knows what is going on, let me know. I don’t want to continue learning OF if all my programs flicker! BTW, using a 2yr old macbook pro with OS X 10.5.6 .

hi

the equivalent to setSwapInterval(1) in oF is ofSetVerticalSync(true)

both makes the application to draw only on the vertical refresh of the monitor, so if it’s not activated you’re sometimes seeing part of the screen with one frame and the other part with a different frame. that’s why you see the flickering.

Yeah, that did it. It makes since too. Thanks arturo !!

HI

I see this jitter / vertical tearing too.
When setting ofSetVerticalSync(true) it is gone, but now i see an other problem.

I have ofimages moving at a constant speed across and 1920 x 1080 window. But they are now jumping a bit every so often.
I check GPU, CPU and RAM use and non of them are near being maxed out.

I calculate the distance difference likes this:

long updateDT = ofGetElapsedTimeMillis() - lastUpdateTime;
beltPos = beltPos + (beltSpeed * updateDT)/1000.0;

Any ideas why?

thanks,
stephan.