Hi,
I have a need where I need to have separate blending for alpha channel but its not working.
Let me explain with my test.
Alpha blending is enabled and I have set color and alpha mask to true.
- I am clearing my buffer with glClear(0,0,0,1)
- I am drawing a big 2D quad which will have its color blend to half and will “set destination alpha values to zero” (-> this is what I need to achieve !)
Src Color is (1,1,1,0.5)
Here are the blend parameters I am setting
transparencyData.color_blendfunc = BlendInfo.BLEND_FUNC_ADD
transparencyData.alpha_blendfunc = BlendInfo.BLEND_FUNC_ADD
transparencyData.colorSrc_blendfactor = BlendInfo.BLEND_FACTOR_SRC_ALPHA
transparencyData.colorDst_blendfactor = BlendInfo.BLEND_FACTOR_ONE_MINUS_SRC_ALPHA
transparencyData.alphaSrc_blendfactor = BlendInfo.BLEND_FACTOR_ZERO
transparencyData.alphaDst_blendfactor = BlendInfo.BLEND_FACTOR_ZERO
- I am drawing a smaller 2D quad inside the above quad
Src Color is (1,1,1,1)
Here are the blend parameters I am setting
transparencyData.color_blendfunc = BlendInfo.BLEND_FUNC_ADD
transparencyData.alpha_blendfunc = BlendInfo.BLEND_FUNC_ADD
transparencyData.colorSrc_blendfactor = BlendInfo.BLEND_FACTOR_ONE_MINUS_DST_ALPHA
transparencyData.colorDst_blendfactor = BlendInfo.BLEND_FACTOR_DST_ALPHA
transparencyData.alphaSrc_blendfactor = BlendInfo.BLEND_FACTOR_ONE
transparencyData.alphaDst_blendfactor = BlendInfo.BLEND_FACTOR_ZERO
Now while quad rendered by step 2 appears half blended, my desired need where it sets the final alpha value of the destination to zero is not happening.
How I know this is because the quad rendered in step 3 should appear if destination alpha is zero and will not appear if destination alpha is one.
This is making me believe that either the alpha blending which might be happening is not working and getting written to the destination or I am doing something not right !!!
The issue is consistent on my samsung I9300 and the PC PVR emulation. Can you please shed light and help me in what I am trying to do ?