Hello.
I`ve got a question. How can I make a texture, that will be transparent in some places. Lets take an example of the player. I would like it to be transparent in the background. Can I do it with glEnable()? Please help.
Yes.
Either use [icode]glEnable(GL_ALPHA_TEST);[/icode], then only the purely transparent pixels in your texture will be discarded, or:
use [icode]glEnable(GL_BLEND);[/icode]. This will enable blending of semi-transparent pixels. This is much more advanced, and usually you don’t need it. Also different draw orders are giving different results… for example if I draw A over B, the resulting color is different than when I draw B over A.
Finally, please google more, and the docs are your friend:
glEnable();
Alpha Test
Blending
Thanks very much matheus23. ;D
Hopefully you’ve seen the edit … :
Just add this into your display creation:
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
Now you will be able to use transparent textures.
Yes I have, thanks! ;D