GtkGLArea and OpenGL Blending
Hi,
I've been experimenting with GtkGLArea and OpenGL Blending, but can't exactly explain what I'm seeing at some point.
I have a green grid (rgba(0, 255, 0, 1.00)), with two GtkGLAreas on top, one slightly rotated over +y, one slightly rotated over -y. I was searching for Blenders for which rgba(255, 0, 0, 0.50)+rgba(0, 0, 255, 0.50) is commutative, such that I don't have to sort objects before drawing them (this requires doing rotations once on the CPU and once on the GPU, twice in total).
The GtkGLArea's glClearColor is set to rbga(0,0,0,1.00), so I expect a black working surface, impervious to other underlying surfaces, but instead the green is clearly coming through and messing up the blending experiment (first screenshot), unless I explicitly set the GtkGLArea CSS background-color to rgba(0,0,0,1.00) (second screenshot). Then again, the blender is for some reason sensitive to a difference in glClearColor of rbga(0,0,0,0.00) (top GLArea) or rbga(0,0,0,1.00) (bottom GLArea) (third screenshot). All blenders in one group are supposed to give identical results, but I can't fix this as long as the above is unclear to me.
In addition, I noticed that GTK itself is (and all Linux browsers are) also sensitive to the order in which borders colors are drawn on backgrounds colors. This means that once the GtkGLArea is invariant under rotation because of commutative addition, GTK itself still is not. In other words, the GtkGLArea's palette can not be matched to the Gtk palette. Perhaps we can do something about that in time?
Using gl_FragCoord.z in the fragment shader, gives you an idea of where we're heading. You can clearly see that the color of the object stays the same when rotating the object in the other direction, without the need to change the drawing order of the faces.
Best regards, Mischa Baars.