GtkGLArea on OSX Sonoma

Dear all,
I am trying to build an OSX version (Sonoma - 14.4.1 - MacBook Pro - M3 Max) of my program “atomes” (https://atomes.ipcms.fr)

“atomes” is a tool box for atomic scale modeling, it uses the GtkGLArea widget to provide 3D rendering of atomistic models, and can handle several OpenGL window simultaneously.
Both GTK3 and GTK4 versions works nicely on Linux and Windows, and I am trying to provide an OSX version.

Using the “brew” system I can build successfully a GTK3, and, a GTK4 version of “atomes”, however things get messy when I try to run any of those versions.

  1. GTK3

I am not sure if it is appropriate to build a GTK3 version on OSX, still I tried,
in that case everything in the program seems to works really fine except the 3D rendering, the OpenGL window(s) remaining empty:

Note that I observe the same empty area in the gtk3-demo application when I give a try to the GLArea widget

  1. GTK4

Overall the GTK4 build seems less stable that the GTK3, with flickering of the GUI.

  • If a single OpenGL window is opened, the rendering works at first, but If I start to rotate the 3D window, then after a short while the rendering freezes and I can see the following message in the terminal:

OPENGL-CRITICAL **: …/gdk/macos/gdkmacosglcontext.c:202: invalid operation

  • If multiple OpenGL windows are opened, then everything is messy, one window seems to work at first but freezes really quickly, the others are flickering constantly, and quickly all OpenGL windows freeze with the previous message:

OPENGL-CRITICAL **: …/gdk/macos/gdkmacosglcontext.c:202: invalid operation

I noticed that same problem was happening with the gtk4-demo application, when testing the GtkGLArea widget (Shadertoy example in particular).

I am definitely not an expert with OSX, so I would appreciate any help to try and improve my work, because to be honest at this point I have not even a clue where or what to look for.

Thanks in advance for your help !