Jump to content
damyon

Imported textures have no transparency

Recommended Posts

I am trying to create a HUD out of some png images - but whenever I draw the image, it shows white where it should be transparent. The image is saved as a png with an alpha channel, but I tried tga as well with the same result. I am using 3.2 Indie Edition on Linux.

 

The image file is attached.

 

Here is my code to load the image:

 


function Script:Start()

self.texture = Texture:Load("Materials/HUD/hud.tex")

 

end

 

And here is my code to draw it:


function Script:PostRender(context)

context:SetBlendMode(Blend.Alpha)

 

context:SetColor(1, 1, 1)

left = context:GetWidth() - self.texture:GetWidth()

top = context:GetHeight() - self.texture:GetHeight()

context:DrawImage(self.texture,left,top)

context:SetBlendMode(Blend.Solid)

 

context:Sync();

end

 

What I think the problem is:

 

The automated conversion to textures is converting all images to DXCT1 RGB which has no alpha channel, but the working transparent textures that come with the editor use RGBA.

post-12677-0-87741100-1413692430.png

Share this post


Link to post

Aha - I found where to change it and it works now - thanks. Maybe this should be the default for imported images with alpha?

Share this post


Link to post

Most images have alpha, I think. At least PNGS will I chose DXT1 because it uses a lot less space and still looks good.

Share this post


Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...