Screen tearing in ubuntu linux

Hi all, I observe screen tearing .
I am running ubuntu 14.04 64 bit and have an NVIDIA Quadro 2200 GPU. I am also running the closed source driver 331.38 provided by nvidia.

I have always been using

ofSetFrameRate(60);
    ofSetVerticalSync(true);

in my setup().
I still get the tearing though.

Is there any good practices you have to suggest?

Thank you !

you don’t need to set a fraqmerate, setting vertical sync to true should be enough. also on ubuntu 14.04 if your computer has optimus, an intel card and an nvidia one, it’ll use the nvidia card to render openGL but going through the intel one and doens’t support vsync. the best way to solve it is to disable optimus in the bios and just use the discrete graphics card.

if even with that you get tearing, on ubuntu on previous versions unity never did vsync properly, changing to gnome it usually fixes the problem

hi @arturo,
i’'ll try this about optimus. When you say gnome, you mean gnome 2? gnome 3? gnome classic? gnome fallback? see here http://askubuntu.com/questions/83351/which-is-correct-gnome-classic-or-gnome-fallback

i also see tearing on my desktop though. I have an Nvidia Quadro FX 1800 there.
I have also ubuntu studio 14.04 installed , which comes withxfce4. Any hints for this one too?

Thank you!

for me any gnome usually fixes it but my guess is it has to do with compositing so if you still have problems with gnome 3, any of the others or even something like openbox would fix it

I had the same problem on Linux Mint 17.1 with xfce.
Openbox fixed it.
Thanks for the hint!

i discovered later than in unity/compiz you can disable unredirect for some applciations by name or all full screen through the compiz config settings manager which also solves the tearing.

openbox is great though, for installations, is really good cause you get a totally clean system with nothing at all running in the bg

Also, this answer explains in details why it happens: http://unix.stackexchange.com/a/182824/100697