30fps frame stuttering/jitter

Hi I am a somewhat newbie so please bare with me. I am designing a project in the last month for the RPI2. I first noticed a general stuttering when I made a version of the app to vj with via syphon. However at the time I thought it was a Syphon problem. I can only get about 32 fps on the RPI2 which is fine for what I am doing. However there is a stuttering/jitter to the motion. I put the project at 30fps on my mac and I get the same stuttering(which is good that they have the same problem). The project runs completely smooth at 60fps. At first I thought it was the way I was animating. I was using the classic processing way of x+=1; I then switched it to x+=1*(30/ofGetFrameRate()); After reading from the OfBook online that this was a better method and it makes sense. So the animations are the same speed now however it did not fix the stuttering/jitter problem(it may have made it slightly better). It can’t be computer speed if it runs fine at 60fps. I have played with every combination of ofSetVerticalSync and ofSetFrameRate in setup();. There has got to be something I am doing wrong that will fix this. I even studied the jitter and it is the exact same on RPI2 and the mac at 30fps. I have googled extensively. I am a newbie to OF but have been using quartz composer, unity 3d and processing for over three years. Any help will be appreciated greatly. Also did a test with RPI2 with way less objects to get it at 60fps and it doesn’t jitter so it has something to do with the lower frame rate. Thanks in advance!

the value returned by ofGetFrameRate() is very filtered so you shouldn’t rely on that to animate. the best value in order to integrate the animation is ofGetLastFrameTime() which returns the time for the last frame in seconds. so you can do:

x+=ofGetLastFrameTime() * speed;

where speed is usually expressed in pixels/s

can you point where in the book it says that? it’s really not correct and we should fix it

Thanks for the reply! I fixed the code to what ofGetLastFrameTime(). However it did not fix the stuttering/jitter of the animation at 30fps. 60fps is still smooth as silk. I know its twice as less frames but I feel like it shouldn’t be this noticeable. My reference was here in the FrameRate section http://openframeworks.cc/ofBook/chapters/animation.html. Good to know the correct way to do that though.