I am working on a RPG game in C + + and OpenGL. I am Importing TGA images, using Devil library. I am trying to import an image with alpha channel, but in my game the image is displayed with a black background . Can you help me with this?
Are you sure it's not a fault in your rendering function?
Are you sure it's not a fault on the image editing/saving side? Photohsohop 7.0 can't even save TGA with alpha without a plugin.
Do you enable blending?
How you you set up your blending function?
[font=courier new,courier,monospace]glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA)[/font] is the usual way to achieve what you want.
Also, do you set up a rendering environment explicitly (though it shouldn't be a problem, as it's [font=courier new,courier,monospace]GL_MODULATE[/font] by default, if I recall correctly)?
What does [font=courier new,courier,monospace]ilConvertImage(IL_RGBA, IL_UNSIGNED_BYTE)[/font] do?
[color=#000000][font=verdana]llConvertImage converts the current bound image from its format/type to variables. You have full description here:[/font]http://www-f9.ijs.si...L/il/f00016.htm
[color=#000000][font=verdana]I don't use glBlendFunc.[/font]
If you don't use [font=courier new,courier,monospace]glBlendfunc[/font], then you probably don't enable blending either ([font=courier new,courier,monospace]glEnable(GL_BLEND);[/font])
Which means you won't have blending, which means the alpha channel of your image is ignored.