No GL implementation is available

Hi, @ebassi
I add these code after gl_area = gtk_gl_area_new () in main function
and replace epoxy/gl.h with epoxy/egl.h

GdkGLContext *context;
gtk_gl_area_set_use_es (GTK_GL_AREA (gl_area), TRUE);
context = gtk_gl_area_get_context (GTK_GL_AREA (gl_area));
gdk_gl_context_set_use_es (context, TRUE);
gdk_gl_context_set_debug_enabled (context, TRUE);

It return

(a.out:12769): Gdk-CRITICAL **: 11:52:43.145: gdk_gl_context_set_use_es: assertion 'GDK_IS_GL_CONTEXT (context)' failed

(a.out:12769): Gdk-CRITICAL **: 11:52:43.145: gdk_gl_context_set_debug_enabled: assertion 'GDK_IS_GL_CONTEXT (context)' failed

Does this help clarify the issue?

Not really, unfortunately; you’re calling gtk_gl_area_get_context() right after creating the widget, but the function will return NULL until the widget is realized. You need to call gtk_widget_realize (gl_area) before calling gtk_gl_area_get_context().

It won’t really help much, because we know from the error displayed in the GLArea widget that the context creation failed. That’s why I asked for the debugging output.

The problem is definitely related to your environment: GTK and the demo you are using are going to be fairly different. GTK does not link directly to whatever OpenGL implementation is available: it uses libepoxy to dynamically load the appropriate library.

Since we’re flying blind, here, I guess I’ll have to start asking what kind of system you’re using:

  • are you using X11?
  • if you’re using X11, does your platform have a GLX driver?

@ebassi
I’m x11 system, and my platform have a EGL driver ( Is this workable? )

企业微信截图_1721113009255