ofSetVerticalSync-- what does it do exactly?

Hey I’m going through examples and I see that a lot of them set ofSetVerticalSync(true). I tried it with the video player example and am not seeing any immediate differences between having it set to true or false. And there doesn’t seem to be much of a description about it in documentation. I’m just wondering what does or tries to do. or if there’s an example that clearly illustrates this that I just have to look at.

Thanks!

2 Likes

It synchronizes the redraw of the screen to the vertical refresh of your screen. The monitor or projector redraws the screen at usually 60 frames per second. If you don’t enable the vertical sync your application runs as fast as possible and the screen can be drawing half of one frame and half of the previous, getting an effect called tearing

to avoid it you synchronize the update / draw of your app with the refresh of the screen.

By default since 0.8.0 vsync is enabled you can disable it calling ofSetVerticalSync(false)

If you draw the frame rate of the application you can see how the app runs at 60fps usually with vsync enabled and way faster without it

7 Likes

@arturo sweet that makes sense thanks for explaining it.