[SOLVED] Button image has black background, not transparent

For help with general CEGUI usage:
- Questions about the usage of CEGUI and its features, if not explained in the documentation.
- Problems with the CMAKE configuration or problems occuring during the build process/compilation.
- Errors or unexpected behaviour.

Moderators: CEGUI MVP, CEGUI Team

noatom
Just popping in
Just popping in
Posts: 17
Joined: Sat Oct 04, 2014 23:37

[SOLVED] Button image has black background, not transparent

Postby noatom » Tue Oct 07, 2014 10:14

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>
Last edited by noatom on Tue Oct 07, 2014 13:02, edited 1 time in total.

User avatar
Kulik
CEGUI Team
Posts: 1382
Joined: Mon Jul 26, 2010 18:47
Location: Czech Republic
Contact:

Re: Button image has black background, not transparent

Postby Kulik » Tue Oct 07, 2014 10:48

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.

noatom
Just popping in
Just popping in
Posts: 17
Joined: Sat Oct 04, 2014 23:37

Re: Button image has black background, not transparent

Postby noatom » Tue Oct 07, 2014 11:03

Link to the image: https://drive.google.com/file/d/0B2VZua ... sp=sharing

Link to cegui log: http://pastebin.com/0QKSUZWc

I'd also appreciate if you gave me the correct xml codes for making the frame of the button disappear.

User avatar
Ident
CEGUI Team
Posts: 1995
Joined: Sat Oct 31, 2009 13:57
Location: Austria

Re: Button image has black background, not transparent

Postby Ident » Tue Oct 07, 2014 11:30

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.
CrazyEddie: "I don't like GUIs"

noatom
Just popping in
Just popping in
Posts: 17
Joined: Sat Oct 04, 2014 23:37

Re: Button image has black background, not transparent

Postby noatom » Tue Oct 07, 2014 11:50

I personally did not manually set any Imagecodec, so it should be the default one.

User avatar
Kulik
CEGUI Team
Posts: 1382
Joined: Mon Jul 26, 2010 18:47
Location: Czech Republic
Contact:

Re: Button image has black background, not transparent

Postby Kulik » Tue Oct 07, 2014 12:43

This is the image in CEED, https://i.imgur.com/ULRaErf.png

As 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?

User avatar
Ident
CEGUI Team
Posts: 1995
Joined: Sat Oct 31, 2009 13:57
Location: Austria

Re: Button image has black background, not transparent

Postby Ident » Tue Oct 07, 2014 12:58

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?
CrazyEddie: "I don't like GUIs"

noatom
Just popping in
Just popping in
Posts: 17
Joined: Sat Oct 04, 2014 23:37

Re: Button image has black background, not transparent

Postby noatom » Tue Oct 07, 2014 13:01

Solved: yep, a d3d state was messing with my blending...


Return to “Help”

Who is online

Users browsing this forum: No registered users and 10 guests