alpha blending without modifying destination alpha


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 :slight_smile:


Another way is glColorMask(true,true,true,false);

Ahh yes silly me, of course :slight_smile: facedesks


For completeness, glBlendFuncSeparate (core since 1.4) lets you choose different blend factors for RGB and A channels.