Jump to content

Imported textures have no transparency


damyon
 Share

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

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

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.

 Share

×
×
  • Create New...