GTK4 vs. GTK3: GtkGLArea and opacity

Hello world,
migrating my app from GTK3 to GTK4 I noticed a difference with the behaviour of GtkGLarea between GTK3 and GTK4, and I would appreciate to have your thoughts on that matter.
To be precise everything is working fine, I am able to render my models without any issues, see here the GTK3 version (left) and the GTK4 version (right):


However when I change the opacity of the model (0.5 in the example bellow, as opposed to 1.0 above) something of is happening and I am puzzled to figure out where this issue is coming from:

Obviously the code is the same, the shaders are the same, I checked and compared the materials, lights and other OpenGL parameters before rendering the models, all are identical … so can this difference be explained by a change in the implementation of the GtkGLarea Widget in the new API ?

Thanks in advance for your lights.

S.

In GTK3, changing the opacity of the GLArea widget will cause GTK3 to read back the contents from GL and then blend them with the background color of the container, using Cairo.

In GTK4, the GLArea’s backing texture will painted with a 0.5 alpha. You will need to change the shader to compensate for that.

Thank you very much for the quick reply :wink:

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