alpha channel blending issue

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.


  1. I am clearing my buffer with glClear(0,0,0,1)


  2. 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


  3. 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 !!! :frowning:





    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 ?


Hi,



Thanks for the information. Can you send us a small reproduction of the issue too? If you can generate one, a PVRTrace recording would be preferred.



Thanks,

Joe

Hi Joe,



I emailed you a reproducable demo. Please check and let me know what could be the problem.



Thank !!

Hi Madan,



Sorry for going quiet. I’ve not had a chance to look into your reproduction yet. Another member of our support team is going to look into it for you though. He’ll post his findings in this discussion chain.



Thanks,

Joe

Hello Madan,



As discussed by email this looks to be a behaviour specific to the Nvidia desktop driver on PVRVFrame. I believe you have confirmed it is working as expected on mobile now and I have on an AMD desktop driver.



Thanks for reporting the issue. I’ve filed it in our internal bug tracker as BRN48992 for further investigation.



Thanks,

Paul

The issue was with making the buffer to have alpha channel. This resolved the issue once the parameters were set and it worked on the PC emulator and the device.