gkv311 / occt-samples-gtk

Open CASCADE Technology sample - 3D Viewer within GTK window
Other
13 stars 5 forks source link

Sample fails on Wayland session #2

Open gkv311 opened 2 years ago

gkv311 commented 2 years ago

Sample works with X11 session, where GTK relies on GLX, but fails on Wayland session, where GTK relies on EGL. TKOpenGl doesn't yet implement such combinations - it is either uses GLX (HAVE_XLIB configuration flag) or EGL, not both at once.

However, TKOpenGles (since OCCT 7.6.0) is always built using EGL. This could be used to make builds compatible with both X11 and Wayland sessions (although with limited functionality of OpenGL ES, but still better than nothing).

For this, Gtk::GLArea::set_use_es(true)/gtk_gl_area_set_use_es(true) should be called and sample code should be updated to be linked with TKOpenGles and to wrap EGL context instead of GLX.

GTK 4.4.0 release notes also indicated:

On X11 we use EGL, falling back to GLX if needed

So that in future it might be possible building TKOpenGl (desktop OpenGL) with only EGL and without GLX support compatible with GTK4.4+, but it is unclear when "falling back" is used.