# alpha channel blending issue

**URL:** <https://forums.imgtec.com/t/alpha-channel-blending-issue/2093>\
**Category:** PowerVR Insider\
**Tags:** pvrvframe, pvrtrace\
**Created:** [June 8, 2014, 4:54pm UTC](https://forums.imgtec.com/t/alpha-channel-blending-issue/2093 "2014-06-08T16:54:00Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![mkandula](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.imgtec.com/mkandula/32/123_2.png) [@mkandula](https://forums.imgtec.com/u/mkandula)\
**Post date:** [June 8, 2014, 4:54pm UTC](https://forums.imgtec.com/t/alpha-channel-blending-issue/2093/1 "2014-06-08T16:54:00Z")

</div>

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 !!! ☹  
  
  
  
  
  
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 ?

---

<div class="post-metadata">

**Author:** ![JoeDavis](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.imgtec.com/joedavis/32/71_2.png) [@JoeDavis](https://forums.imgtec.com/u/JoeDavis)\
**Post date:** [June 9, 2014, 8:19am UTC](https://forums.imgtec.com/t/alpha-channel-blending-issue/2093/2 "2014-06-09T08:19:36Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![mkandula](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.imgtec.com/mkandula/32/123_2.png) [@mkandula](https://forums.imgtec.com/u/mkandula)\
**Post date:** [June 9, 2014, 1:49pm UTC](https://forums.imgtec.com/t/alpha-channel-blending-issue/2093/3 "2014-06-09T13:49:08Z")

</div>

Hi Joe,  
  
  
  
I emailed you a reproducable demo. Please check and let me know what could be the problem.  
  
  
  
Thank !!

---

<div class="post-metadata">

**Author:** ![JoeDavis](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.imgtec.com/joedavis/32/71_2.png) [@JoeDavis](https://forums.imgtec.com/u/JoeDavis)\
**Post date:** [June 16, 2014, 6:34am UTC](https://forums.imgtec.com/t/alpha-channel-blending-issue/2093/4 "2014-06-16T06:34:16Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![pauls](https://avatars.discourse-cdn.com/v4/letter/p/b3f665/32.png) [@pauls](https://forums.imgtec.com/u/pauls)\
**Post date:** [June 18, 2014, 8:51am UTC](https://forums.imgtec.com/t/alpha-channel-blending-issue/2093/5 "2014-06-18T08:51:05Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![mkandula](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.imgtec.com/mkandula/32/123_2.png) [@mkandula](https://forums.imgtec.com/u/mkandula)\
**Post date:** [June 25, 2014, 1:47am UTC](https://forums.imgtec.com/t/alpha-channel-blending-issue/2093/6 "2014-06-25T01:47:43Z")

</div>

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.
