PDA

View Full Version : alpha blending without modifying destination alpha



GordAllott
09-20-2009, 04:19 PM
hi,

I am working with a setup where i am drawing onto a buffer with an alpha component and am having some problem with alpha blending.

Essentially there are some times when i blend where i want the texture i am drawing to modify the screen buffers alpha channel and there are some times where i don't want it to modify the screen buffers alpha channel. Yet i want it in both times to use the alpha channel to blend the RGB channels with the screen buffer.

an example would be creating a transparent buffer, rendering a semi-transparent texture to it as a "background" and then rendering some text on top of that, i don't want the text's alpha channel to affect the buffers alpha channel.

something tells me that I can do this with blend modes but thats always been a weakness of mine. Any help will be appreciated :)

gord,

Ilian Dinev
09-20-2009, 04:42 PM
Another way is glColorMask(true,true,true,false);

GordAllott
09-21-2009, 01:42 AM
Ahh yes silly me, of course :) *facedesks*

thanks

Xmas
09-21-2009, 03:15 AM
For completeness, glBlendFuncSeparate (core since 1.4) lets you choose different blend factors for RGB and A channels.