Hi, i’m working on a personal project, specifically a stream overlay that i composite in using OBS and keying out pure black. I’m using the DesktopGL framework, and want to get a transparent background, but have everything that i render in on top show at full opacity. I’ve seen this done with WinForms, and WPF, but those require windows, and i don’t like or run that. is there a way to render a window with a transparent background in the DesktopGL version of MonoGame?
You’d have to call the SDL functions directly. There’s some info here: https://stackoverflow.com/a/51956224/1710293
I have an example project showing how to call the SDL functions from MonoGame: https://github.com/Apostolique/MonoGameContinuousUpdate
Specifically, grab:
https://github.com/Apostolique/MonoGameContinuousUpdate/blob/main/Game/SDL2.cs
using static SDL2.SDL;
To call the win32 function, you can do something like I did here:
that does help, however, the first link you posted seems to rely on some win32 stuff, which i’ve already stated won’t work for me (i’m using linux), so i was hoping for an alternative to something that relies on windows APIs
On Linux it’s a bit more complicated it seems. Which distro are you on?
There might be a lead here: https://stackoverflow.com/a/9380468.
currently i’m using manjaro, with KDE as the DE and picom replacing the stock compositor
You might be able to write a custom window shader: https://github.com/chjj/compton/commit/81c677f28b93bb526f98be9c0e5d144c932000cd#diff-6eee6052ea713181527fae1ae227f1cd.
Search for fshader: https://manpages.debian.org/testing/compton/compton.1.en.html.
I saw an example for grayscale here: https://wiki.archlinux.org/title/Picom#Grayscale.
Not sure how you apply that specifically to target your game but I’m sure it’s explained somewhere in the docs. (Or if this is the best solution.)