3 ms·
I implemented fullscreen OpenGL in my 3D engine a few years ago and this was kind of an interesting part. It was one of the hardest to get right, especially if
by badsectoracula 6y ago
I implemented fullscreen OpenGL in my 3D engine a few years ago and this was kind of an interesting part. It was one of the hardest to get right, especially if you want to avoid dictating sort of WM your users will have to use (which IMO is one of X11 strengths over pretty much any other desktop GUI).
Some window managers treat any window that covers the entire screen as being fine to bypass composition. Other window managers need hints - which will be ignored by some other window managers. And a few compositors simply seem to ignore any hint or window state, but they will disable composition for fullscreen windows that also bypass window management (which in general is kind of a "nuclear option" for fullscreen modes since it also bypasses other window manager functionality like alt-tab, etc). Also as a cherry on top, i had a window manager which refused to treat the window as a fullscreen window (added borders, etc) unless i set up things in a very specific order (which i found out via trial and error because normally it shouldn't be an issue - and wasn't in every other window manager i tried).
(that last part was kinda interesting because i downloaded every window manager i could find on Debian and after i tested my code and debugged it with everything i could get my hands on, i sent it to a friend of mine to try it out and he immediately told me that in his computer he got borders :-P)
Should be noted that neither SDL1 nor SDL2 (which are pretty much recommended by people who haven't bothered to create their own engines as "obvious" solutions to not have to bother with OS-specific stuff) handled all the above (SDL1 always bypasses the window manager, which in general works but disables alt-tabbing and other WM functionality whereas SDL2 assumes all window managers support the fullscreen hint, which is certainly not the case - especially with more minimalistic window managers - while compositor support is hit and miss).