Plots
Plots copied to clipboard
Warning: OpenGL 3.2.0 is unsupported despite that my GPU should support up to OpenGL 4.6
My desktop is using a GTX 970 with the proprietary driver stack version 515.65.01. This should support OpenGL 4.6 according to glxinfo and I don't have any issues running games and such. Yet despite this, when I launch Plots I'm greeted by a message saying that OpenGL 3.2.0 is unsupported:
What could be causing this? I am using Plots 0.8.1 from Flathub for what it's worth, and other Flatpak apps don't seem to have issues with 3D acceleration (SuperTuxKart and Trigger Rally both work fine). Could it be that it's picking OpenGL ES 3.2 (and thus the 3.2.0 version number) for some reason? I'm reminded of this: https://gitlab.gnome.org/GNOME/gtk/-/merge_requests/4687
I've added some debug information, please could you check what the latest version (0.8.3) prints when run in a terminal?
This is what I'm getting:
$ flatpak run app/com.github.alexhuntley.Plots/x86_64/master
OpenGL version: 3.2
Looks like you aren't using OpenGL ES then.
So either I could lower the minimum version for the warning (assuming the app still works for you?), or remove it completely. I imagine on GTK 4 it's safe to assume we have a relatively modern OpenGL.
So either I could lower the minimum version for the warning (assuming the app still works for you?)
It still works as far as I can tell
or remove it completely. I imagine on GTK 4 it's safe to assume we have a relatively modern OpenGL.
Not necessarily. GTK 4 supports OpenGL ES 2.0 as its minimum. Not sure about "desktop" OpenGL.
It seems like OpenGL 3.0 is the lowest "legacy" OpenGL version GTK 4 tries to pick (not sure what legacy means), OpenGL 3.2 is the lowest OpenGL version it tries to pick, and OpenGL ES 2.0 is the lowest OpenGL ES version: https://gitlab.gnome.org/GNOME/gtk/-/blob/cefb0a3eb8f9a52283ce4368ccc78425db0914b0/gdk/gdkglcontextprivate.h#L36-50
Okay, so I tried building GTK with this stupid patch applied: 4.6-required-opengl.patch.txt
And after applying this, lo and behold:
$ flatpak run app/com.github.alexhuntley.Plots/x86_64/master
OpenGL version: 4.6
As well as no warning in Plots:
So I guess GTK just picks the lowest supported non-legacy version on my system. I really wonder why it wouldn't do this on other systems.
Very interesting. Presumably it's due to some quirk in the NVIDIA driver.
So I need to look into whether Plots really needs 3.3, or whether a lower version would be acceptable.
We could also try using GLArea.set_required_version
to request a more recent context. What happens if you add a call to it in GraphArea.__init__
in graph.py
? (with the unpatched GTK)
Does this look like what you had in mind:
diff --git a/plots/graph.py b/plots/graph.py
index 9605bdb..2243584 100644
--- a/plots/graph.py
+++ b/plots/graph.py
@@ -35,6 +35,7 @@ class GraphArea(Gtk.GLArea):
def __init__(self):
super().__init__()
+ self.set_required_version(3, 3)
self.scale = self._target_scale = self.INIT_SCALE
self._translation = np.array([0, 0], 'f')
self.vertex_template = jinja_env.get_template('vertex.glsl')
It does not seem to help unfortunately:
$ python3 -m plots
OpenGL version: 3.2
That's surprising. What if you request 4.6?
That's surprising. What if you request 4.6?
Same result. Could it be that it has no affect since the Area already is realised when this is called?
It's possible. Try printing self.get_realized()
?
diff --git a/plots/graph.py b/plots/graph.py
index 9605bdb..ec0d499 100644
--- a/plots/graph.py
+++ b/plots/graph.py
@@ -35,6 +35,8 @@ class GraphArea(Gtk.GLArea):
def __init__(self):
super().__init__()
+ self.set_required_version(4, 6)
+ print(self.get_realized())
self.scale = self._target_scale = self.INIT_SCALE
self._translation = np.array([0, 0], 'f')
self.vertex_template = jinja_env.get_template('vertex.glsl')
$ python3 -m plots
False
OpenGL version: 3.2
So I guess it isn't realised when this happens. Wonder what it could be then.
I'm getting this issue myself on ubuntu (22.10) using the flatpak install.
Anyone know the fix?
OpenGL version string: 4.6.0 NVIDIA 530.41.03
this an nwidia probwem?