tags:

views:

76

answers:

2

Do i need Alpha channels for transparency to work in OpenGL? can i use glBlendFunc or anything else to make somehow the Black or White color transparent/not visible? if yes, how to do it?

+1  A: 

Yes, you need alpha channels to use transparency. You can emulate the behaviour of color keying using shaders, or processing the image and replacing the color key with pixels with alpha = 0.0.

Notice that GPUs always allocate RGBA textures, even if you want a RGB texture. The alpha channel is still present in hardware.

Matias Valdenegro
"Notice that GPUs always allocate RGBA textures, even if you want a RGB texture. The alpha channel is still present in hardware." -> do you have a reference for this please ? I never heard of this, even if it makes sense.
Calvin1602
@Calvin That comment comes from NV/AMD engineers, but i think i saw some references in slides.
Matias Valdenegro
+1  A: 

No, you don't need an alpha channel in your textures. Call discard in your fragment shader for all fragments that match your transparency rule.

Malte Clasen