Gtk4-rs Unable to run glium_gl_area example

I’m new to OpenGL, so I’m unsure if I’m just missing some dependency. I’m on Fedora 40 and I’m trying to implement a GLArea in my gtk4 application written with the gtk4-rs bindings, and I’m following the example provided in the gtk4-rs repo. When I run the example with

cargo run --bin glium_gl_area

I get the following error:

thread 'main' panicked at examples/glium_gl_area/glium_gl_area/
called `Result::unwrap()` on an `Err` value: NoVersion
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

I went to the glium codebase and I found that this error is thrown form the !program macro when is_glsl_version_supported() can’t find a supported version, but when I run glxinfo | grep OpenGL I get:

OpenGL vendor string: Intel
OpenGL renderer string: Mesa Intel(R) UHD Graphics 620 (WHL GT2)
OpenGL core profile version string: 4.6 (Core Profile) Mesa 24.0.5
OpenGL core profile shading language version string: 4.60
OpenGL core profile context flags: (none)
OpenGL core profile profile mask: core profile
OpenGL core profile extensions:
OpenGL version string: 4.6 (Compatibility Profile) Mesa 24.0.5
OpenGL shading language version string: 4.60
OpenGL context flags: (none)
OpenGL profile mask: compatibility profile
OpenGL extensions:
OpenGL ES profile version string: OpenGL ES 3.2 Mesa 24.0.5
OpenGL ES profile shading language version string: OpenGL ES GLSL ES 3.20
OpenGL ES profile extensions:

So I thought I’m just missing a dependency, so I installed OpenGL devel libraries according to this wiki article, which didn’t fix the issue of running the example. I ran some C++ code to see if it can see if GL_VERSION_1_4 was supported with the glewIsSupported() function from <GL/glew.h> which returned true… I’m unsure what to do next about resolving this issue. Any ideas?

Edit: I’m hesitant to open an Issue on GitHub for glium or gtk4-rs if it’s a simple dependency issue.

Edit 2: I am able to compile and run the demo here.

You’ll have to bring that up with the glium developers. For whatever reason it doesn’t find a suitable way to compile that shader on your system.

Glium is no longer actively developed, but I will attempt to solve this issue and PR.

Considering that glium had a new release with API changes 4 months ago, I don’t think that’s correct.

FWIW, I get the same problem here with the example. The problem is that GTK switched to using GLES by default with 4.14, and that breaks the example because it assumes normal GL. For now you can work around it with GDK_DEBUG=gl-disable-gles but I’m checking what the correct solution would be.

See glium_gl_area: Doesn't work with GTK 4.14 · Issue #1731 · gtk-rs/gtk4-rs · GitHub

examples: Support GL >= 3.1 and GLES >= 3.0 in the glium example by sdroege · Pull Request #1733 · gtk-rs/gtk4-rs · GitHub is probably the best we can do here

Thank you. That fixed it on my end, as well, I didn’t think it was an actual issue worth reporting.

1 Like