Page 1 of 1

[solved] Image Window alpha not working as expected

Posted: Thu Jun 24, 2010 23:51
by Excizted
Hello,

I've used the approach to have a simple Window containing an Image, as described here:
viewtopic.php?f=10&t=4744&p=22359&hilit=simple+image#p22359

It works just fine, except I want to add transparency - the Image tones out, but it seems like theres actually some constant color behind the image - it doesn't reveal whats actually behind the window.

Could anyone point me in the right direction? :)

Thank you so much!

Re: Image Window alpha not working as expected

Posted: Fri Jun 25, 2010 04:31
by agamemnus
Just a guess, but it might be that the color you see is the actual background behind CEGUI windows.

If so, and you are using Irrlicht, read this:
viewtopic.php?f=3&t=4943

Re: Image Window alpha not working as expected

Posted: Fri Jun 25, 2010 12:08
by Excizted
agamemnus wrote:Just a guess, but it might be that the color you see is the actual background behind CEGUI windows.

If so, and you are using Irrlicht, read this:
viewtopic.php?f=3&t=4943


Not using IrrLicht though.. Ogre..

Re: Image Window alpha not working as expected

Posted: Tue Jun 29, 2010 14:55
by Excizted
I've tried so much now, really can't solve it!
Is there no one out there who has had the same issue?

Re: Image Window alpha not working as expected

Posted: Tue Jun 29, 2010 20:08
by agamemnus
Check cegui/src/RendererModules/Ogre/CEGUIOgreGeometryBuffer.cpp. You can see it has both "S_alphaBlendMode" and "S_colourBlendMode".

Re: Image Window alpha not working as expected

Posted: Tue Jun 29, 2010 21:53
by Excizted
Yes, I've checked that file and seen those two, but not been able to figure out furthermore what they are used for.
They are both used in initialiseTextureStates().

Re: Image Window alpha not working as expected

Posted: Tue Jun 29, 2010 22:11
by Excizted
I've found that you don't actually see the viewport background of the renderer.
The image just doesn't alpha at all.

Re: Image Window alpha not working as expected

Posted: Tue Jun 29, 2010 22:37
by Excizted
Finally!
Issue resolved! :)

Added a fifth argument to the draw call:

Code: Select all

CEGUI::ColourRect(CEGUI::colour(1.f, 1.f, 1.f, this->getAlpha()))


Ending with a function like this:

Code: Select all

void ImageWindow::populateGeometryBuffer()
{
    if(d_image)
        d_image->draw(*d_geometry, CEGUI::Vector2(0, 0), d_pixelSize, 0, CEGUI::ColourRect(CEGUI::colour(1.f, 1.f, 1.f, this->getAlpha())));
}