Im trying to create a simple splash screen which:
1. loads an image (.png that has transparent parts)
2. renders the image and its transparency by itself (no window, titlebar, etc)
My image.png loads fine but the transparency isn't transferring over to the window.
ie. If I load 2 images and position one behind the image with transparency. The second image is shown through the transparent parts of the first image.
If I load the single transparent image and render it my desktop and other windows behind the RenderWindow aren't showing through the image's transparent parts.
It just displays black in those areas.
I have the clear color set to (0, 0, 0, 0), so it has a 0 alpha channel but its not as simple as that.
Im not sure if what Im wanting is even possible.
My code:
// Inside int main()
splashWindow.create(sf::VideoMode(splashTextureSize.x, splashTextureSize.y, 32),
"None",
sf::Style::None);
splashWindow.clear(sf::Color(0, 0, 0, 0));
splashWindow.draw(splashSprite);
splashWindow.display();
splashShprite is the .png image which contains transparent sections.
Ive also tried messing with different ContextSettings (using different gl versions from 2.0 to 4.3) to no avail.
Any Ideas,
Thanks in advance!
Does sfml expose any of the os specific windows functions, like the x window lib?
** Update
Ive been looking through the sfml source while reading about the X window library, what I found is this:
It seems that for what I want to do, I would have to modify my windows background pixmap and either set it to the parent (unmodifiable image of my desktop) or copy from parent (would allow me to do image filtering etc.).
In the sfml source (src/SFML/Window/Linux/WindowImplX11.cpp) I found this:
// Define the window attributes
XSetWindowAttributes attributes;
attributes.event_mask = eventMask;
attributes.override_redirect = fullscreen;
If I modified it so that I add...
(I would have to ensure that my window has the same depth as the parent too...)
// Define the window attributes
XSetWindowAttributes attributes;
attributes.event_mask = eventMask;
attributes.override_redirect = fullscreen;
// My code
attributes.background_pixmap = ParentRelative // I believe ParentRelative is the x11 const / enum?
I intend to test this myself when I have more time (since Ill probably be recompiling sfml a lot to test it Ill probably save it for the weekend ;D)
In the mean time; do you believe this is the solution im looking for?
Would I even have to recompile sfml, could I just modify the X windows attributes from the window handle provided by sfml?