I decided in my 2d game to add depth so that you could set on which plan objects should be drawn and ran into such a problem: how to choose the correct glBlendFunc . For texturing, I use png , so I initially used a function of this type:
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); As far as I can tell, this function uses alpha for blending, which I can only have 2 values: 0 (for transparency ) and 1 (if there is anything). When we mix the background color, for example 0,1,0,1 and transparency , we get the background color (green) with alpha = 1 - and that’s the problem. Since then we can draw an object in the background, and it will already be visible, since the transparency with its alpha = 0 has been replaced with green color, with alpha = 1. I see the way out when mixing, for the final color I chose a smaller alpha , but I can't figure out how to write this in glBlendFunc .