Is it really impossible to create a GdkGLContext with a shared context?

It seems the only way to create a GdkGLContext is through GdkWindow, which does not allow to specify a shared context. The “shared-context” property being construct-only, I figured I could try g_object_new() directly, but GdkGLContext is an abstract type, so no luck.

Is the sharing really reserved for internal use ? What’s the point of the get_shared_context() getter then ?


All GdkGLContext instances are shared with the paint context used by GDK internally to render to a GdkWindow. This means that every GdkGLContext created by GDK is automatically shared.

The “shared-context” property is meant to be used by the various GdkGLContext implementations in every GDK windowing system backend.

So you can access the GL context used by GDK.

Thank you, that clarifies things.

I’m using the context created by GLArea to initialize bgfx. I steal the FBO’s color attachment and make bgfx render into it, and all works perfectly (except that I need to call GLX directly to obtain the low-level context, so that won’t work if gdk uses e.g. EGL, like on wayland)

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.