"Optimus" is the tech where your laptop has an Intel AND an Nvidia card, the amount of problems this can cause are more than the sum of the parts on Linux.
Trying to run apps on the Nvidia card had all sorts of issues until I switched the intel card on 'SNA' ("the successor to UXA").
It seems like every few years intel changes how their graphics cards work, and the new hotness is SNA.
Before this, glitches included black windows, and apps just freezing until I resized their windows, or if you ran more than one GL app.
As per the answer here at https://ask.fedoraproject.org/en/question/32960/black-windows-in-gnome-3-suddenly add the following to your /etc/X11/xorg.conf
Section "Device"
Identifier "Intel Graphics"
Driver "intel"
Option "AccelMethod" "sna"
EndSection
I'm not sure it's entirely problem free, I have had one or two logouts, but at least I can run more than one instance of my own app without random freezing and glitching.
[EDIT]
It turns out I'm still getting glitchyness and lockups running on intel, at least running things on the Nvidia card with DRI_PRIME=1 works though.
[/EDIT]