How to use OpenGL in a Gdk.GLContext


I’m aware that I can use gdk_cairo_draw_from_gl() to draw OpenGL textures and framebuffers to a Cairo surface. However, I am running into performance issues with the app I am running and was wondering if there was a way for me to implement my own texture drawing function.

Is there a way to render pure OpenGL in a Gdk.GLContext. I tried clearing the screen to a given colour with glClearColor() but there was no visual change.

Have you looked at the glarea example? It’s for GTK3, but it works the same way in GTK4.

1 Like