PDA

View Full Version : transparency in tga files get black in opengl...



hellox
04-14-2003, 01:26 PM
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?

Thanks for any help =)

JML from PT

nexusone
04-14-2003, 01:48 PM
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:
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?

Thanks for any help =)

JML from PT

HS
04-14-2003, 02:10 PM
http://www.wotsit.org/

raverbach
04-15-2003, 05:39 AM
depending on your video card , the constants
of

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

deadalive
04-15-2003, 02:18 PM
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);

ioquan
04-15-2003, 03:02 PM
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.

hellox
04-17-2003, 01:32 PM
Well thanks alot =)))) ive made it, really thanks

JML from PT