Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Warning: OpenGL 3.2.0 is unsupported despite that my GPU should support up to OpenGL 4.6 #72

Open
Newbytee opened this issue Sep 21, 2022 · 13 comments

Comments

@Newbytee
Copy link

Newbytee commented Sep 21, 2022

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:

image

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

@Newbytee Newbytee changed the title Warning: OpenGL 3.2.0 is unsupported despite that my GPU should support up to OpenGL Warning: OpenGL 3.2.0 is unsupported despite that my GPU should support up to OpenGL 4.6 Sep 21, 2022
@alexhuntley
Copy link
Owner

I've added some debug information, please could you check what the latest version (0.8.3) prints when run in a terminal?

@Newbytee
Copy link
Author

This is what I'm getting:

$ flatpak run app/com.github.alexhuntley.Plots/x86_64/master
OpenGL version: 3.2

@alexhuntley
Copy link
Owner

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.

@Newbytee
Copy link
Author

Newbytee commented Sep 25, 2022

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.

@Newbytee
Copy link
Author

Newbytee commented Sep 25, 2022

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

@Newbytee
Copy link
Author

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:

image

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.

@alexhuntley
Copy link
Owner

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)

@Newbytee
Copy link
Author

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

@alexhuntley
Copy link
Owner

That's surprising. What if you request 4.6?

@Newbytee
Copy link
Author

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?

@alexhuntley
Copy link
Owner

It's possible. Try printing self.get_realized()?

@Newbytee
Copy link
Author

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.

@ghost
Copy link

ghost commented May 13, 2023

I'm getting this issue myself on ubuntu (22.10) using the flatpak install.
image
Anyone know the fix?
OpenGL version string: 4.6.0 NVIDIA 530.41.03
this an nwidia probwem?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants