Page 1 of 1
[SOLVED] Button image has black background, not transparent
Posted: Tue Oct 07, 2014 10:14
by noatom
Basically, I'm trying to load an image for the normal look of a button, the problem is, when the image is loaded, the button's background which is transparent in the original image, is turned to black. So how should I go about fixing this?
I'm also trying to remove the button frame, but with no success...
This is my current layout code:
Code: Select all
<?xml version="1.0" encoding="UTF-8" ?>
<GUILayout version="4" >
<Window type="TaharezLook/Button" name="btnLogin" >
<Property name="Position" value="{{0,0},{0,0}}" />
<Property name="MaxSize" value="{{1,0},{1,0}}" />
<Property name="Size" value="{{0.3,0},{0.15,0}}" />
<Property name="NormalImage" value="loginButton/btnNormal" />
<Property Name="BackgroundEnabled" value="false" />
<Property Name="FrameEnabled" value="false" />
<Property Name="UseStandardImagery" value="false" />
</Window>
</GUILayout>
Re: Button image has black background, not transparent
Posted: Tue Oct 07, 2014 10:48
by Kulik
Please post the log. I am interested in your image codec.
If you can, please post either your image itself, or a different image that has the same problem. I need to check if it really has an alpha channel.
Re: Button image has black background, not transparent
Posted: Tue Oct 07, 2014 11:03
by noatom
Link to the image:
https://drive.google.com/file/d/0B2VZua ... sp=sharingLink to cegui log:
http://pastebin.com/0QKSUZWcI'd also appreciate if you gave me the correct xml codes for making the frame of the button disappear.
Re: Button image has black background, not transparent
Posted: Tue Oct 07, 2014 11:30
by Ident
There should be a property called FrameEnabled, just change it to "False". You can do this either in your layout file or using the setProperty function - see the docu for more info.
Kulik asked you for the Imagecodec you use in your CEGUI setup. The Imagecodec could under circumstances load your image wrongly. CEGUI definitely can handle alpha channels of images well and we do that in our stock files. So it is most likely your chosen ImageCodec causing the issue.
Re: Button image has black background, not transparent
Posted: Tue Oct 07, 2014 11:50
by noatom
I personally did not manually set any Imagecodec, so it should be the default one.
Re: Button image has black background, not transparent
Posted: Tue Oct 07, 2014 12:43
by Kulik
This is the image in CEED,
https://i.imgur.com/ULRaErf.pngAs you can see transparency works fine.
And I set it up to use the same image codec:
Code: Select all
********************************************************************************
* Important: *
* To get support at the CEGUI forums, you must post _at least_ the section *
* of this log file indicated below. Failure to do this will result in no *
* support being given; please do not waste our time. *
********************************************************************************
********************************************************************************
* -------- START OF ESSENTIAL SECTION TO BE POSTED ON THE FORUM -------- *
********************************************************************************
---- Version: 0.8.4 (Build: Oct 6 2014 GNU/Linux g++ 4.8.3 20140911 (Red Hat 4.8.3-7) 64 bit) ----
---- Renderer module is: CEGUI::OpenGLRenderer - Official OpenGL based 2nd generation renderer module. TextureTarget support enabled via FBO extension. ----
---- XML Parser module is: CEGUI::ExpatParser - Official expat based parser module for CEGUI ----
---- Image Codec module is: SILLYImageCodec - Official SILLY based image codec ----
---- Scripting module is: None ----
********************************************************************************
* -------- END OF ESSENTIAL SECTION TO BE POSTED ON THE FORUM -------- *
********************************************************************************
It could be that you are doing something to the D3D11 state that prevents alpha blending from working. Could you try to comment your own rendering code to confirm that?
Re: Button image has black background, not transparent
Posted: Tue Oct 07, 2014 12:58
by Ident
You use "SILLYImageCodec" btw. We use transparent images in the SampleBrowser and I tested them with CEGUI in D3D and had no issues. Can you confirm that transparency looks correct in the SampleBrowser in your setup on your machine?
Re: Button image has black background, not transparent
Posted: Tue Oct 07, 2014 13:01
by noatom
Solved: yep, a d3d state was messing with my blending...