Skip to content

gdk_wayland_display_init_gl: use GLES API if required

Dominique Martinet requested to merge martinetd/gtk:gtk-3-gles into gtk-3-24

gdk_wayland_gl_context_realize properly checks for GLES and uses eglBindAPI with the proper API, but before that init is always called with regular GL interface which is not implemented for many embedded devices.

This was fixed in GTK 4 with commit 482845b0 ("wayland: Remove initial GL API bind"), but that commit cannot easily be applied because the current version queries some GL properties during init so we would need to backport more for it to be applicable.

This patch takes the minimal approach of initializing GLES context, allowing the gtk3 demo OpenGL test (and real applications) to work when GDK_GL=gles is set.

Fixes #3028 (closed)


I'm not sure what the policy is to backport into gtk 3 -- This would still be extremely useful for us one way or another, so I'd be happy to try harder to pick requirements for 482845b0 if you need gtk3 commits to be things that landed in gtk 4.

I also realize it's not ideal to rely on env var, but I don't have any better idea at this point -- Happy to take any advice here 😄

Merge request reports