hi! iam trying to use tga files for textures, i know that opengl supports transparency in tga files but iam not getting any… Ive downloaded the NeHe tutorial for tga files, compiled it and i cant get the transparency to work. The texture gets black were it should be transparent. Does anyone one know why or how to avoid it?
Which NEHE tutor?
What version compiler, VC6, DEV, Linux, etc?
What OS are you using?
I have had no problems with any of the NEHE tutors, is this his TGA or one that you have made???
Originally posted by hellox:
[b]hi! iam trying to use tga files for textures, i know that opengl supports transparency in tga files but iam not getting any… Ive downloaded the NeHe tutorial for tga files, compiled it and i cant get the transparency to work. The texture gets black were it should be transparent. Does anyone one know why or how to avoid it?
glBlendFunc(GL_SRC_ALPLHA,GL_ONE_MINUS_SRC_ALPHA)
does not give you quite an satisfactoy result , try changing them to
GL_ONE_MINUS_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA
I’m using something similar to Nehe’s transparancy code ( but, not ) it draws a black mask with (GL_DST_COLOR ,GL_ZERO);
and then a colored image with (GL_ONE, GL_ONE) over it. But I don’t like the fact I need to make a mask texture and draw twice…
Does one actually need to do this? Can’t I somehow reduce it to just one quad?
His font code uses transparency, and only draws once with ( GL_DST_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
Just make sure you have blending enabled with glEnable(GL_BLEND) and have the appropriate blend function set with glBlendFunc() before you draw something with the texture.