Hello,
I have a question about blending.
Rendering on a black background and trying to add a second surface to a first surface using:
glBlendFuncSeparate (GL_ONE, GL_ZERO, GL_ONE, GL_ZERO); // default
glBlendEquationSeparate (GL_FUNC_ADD, GL_FUNC_ADD); // default
Depending on the order in which the surfaces are drawn, I get the following results:
rgba rgb src_rgb dst_rgb src_a dst_a
src 0.00 0.00 1.00 0.50 0000FF80 000080FF 1.00 0.00 1.00 0.00
dst 0.50 0.00 0.00 1.00 800000FF 800000FF
out 0.00 0.00 1.00 0.50 0000FF80 000080FF out_rgba rgb part used; out_rgba a part unused; out_rgb unused;
and
rgba rgb src_rgb dst_rgb src_a dst_a
src 1.00 0.00 0.00 0.50 FF000080 800000FF 1.00 0.00 1.00 0.00
dst 0.00 0.00 0.50 1.00 000080FF 000080FF
out 1.00 0.00 0.00 0.50 FF000080 800000FF out_rgba rgb part used; out_rgba a part unused; out_rgb unused;
By sampling the output colors from the screen, it appears that the RGB portion of o_rgba (i.e. #0000FF and #FF0000) is being used as the output color, where o_rgb was expected, and that the A portion of o_rgba (i.e. #80 and #80) is not being used to compute o_rgb or at least o_rgb is not the color on the screen.
I’ve tried to solve this by inspecting glColorMask(), but all values are set to GL_TRUE.
Using
glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
I get comparable results. Again it is the RGB portion of o_rgba that ends up on the screen.
Can someone please explain?
Best regards,
Mischa Baars, the Netherlands.