# Why do the ALPHA channel in TGA is not visible?

Good morning GDSE,

I am loading a TGA using loadTGA function found in superbible 4th edition source code. Here is how the image looks in Gimp

You can see I have enabled alpha channel in Gimp, I exported this to TGA image, without RLE compression, and 32bpp. But when I load the image in my OpenGL code, the part of the image which is supposed to be transparent is seen white.

Where I must be going wrong? The type of TGA is set to GL_RGBA, 32 bpp.

Here is my Fragment shader code.

out_fragColor = (vec4( ambAndDiff, 1 ) * texColor) + vec4(spec,0.0);

I have calculated ambAndDiff and spec values earlier using ADS phong shading, and both of them are vec3. Let me know if you also want to view the TGA loading code. :)

Regards, A.

• It looks like you haven't enabled alpha blending. Try this: glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); – shade4159 Nov 19 '13 at 5:32
• Not sure alpha blending is the problem. The Gimp sets the alpha value of fully transparent pixels to black, not white. – sam hocevar Nov 19 '13 at 8:00
• Can you post your glTexImage2D call? – Maximus Minimus Nov 19 '13 at 10:29
• @Sam Hocevar, I would like to confirm that it is not the alpha blending problem indeed, @JimmyShelter, here is my glTexImage2D code. tgaType, as mentioned about is GL_RGBA.  glTexImage2D ( GL_TEXTURE_2D, 0, tgaType, planeTexture.width, planeTexture.height, 0, tgaType, GL_UNSIGNED_BYTE, planeTexture.imageData ); ` – 2am Nov 20 '13 at 2:05
• OK, that's correct. It's most likely blend states, as per Tordin's answer then. – Maximus Minimus Nov 20 '13 at 10:50