godotengine / godotengine/godot
Rendering error: When setting screen stretch, black bars remain even when not enabling stretching or fullscreen
- Dominant language
- C++
- Stars
- 117k
- Forks
- 26.8k
- PR merge metrics
- PR metrics pending
Description
### Tested versions
-Reproducable in v3.5.3.stable.official [6c814135b]
### System information
Windows 10, Nvidia GTX 1060, Ryzen 5 2600
### Issue description
I was attempting to make my project in Godot have the option to either stretch the image, or keep the pixels 1 to 1 and use a border. Both of these modes work perfectly fine on their own, however, there is something wrong when switching between them programmatically. The integer scaling mode starts off fine, but when switching to a stretch scaling mode back to integer scaling, then switching to fullscreen, black bars will then be on the sides of the full screen, even when the aspect is set to keep. Going outside of fullscreen, the black bars will still be present in a minimized window, enveloping most of the screen.
I tried for hours to figure out if something specific was causing the issue in my code, but it doesn't seem to be anything specific. I ran it by a user on the Godot forums, and they said it's most likely an engine issue.
Integer scaling enabled (Maximized)

Integer scaling fullscreen enabled after enabling and disabling stretch + fullscreen, then enabling fullscreen

After disabling fullscreen

### Steps to reproduce
1. The project starts fine. If you maximize or press the fullscreen button, the border expands to the appropriate size, and there are no black bars.
2. Switch to stretch mode by clicking the integer scaling button (Disabled). Stretch mode is now on.
3. Press the fullscreen button. It works normally. Press it again to disable it.
4. Press the integer scaling button again (Integer scaling is on). It looks normal at first.
5. Maximize the window or click fullscreen. There are now black bars around the border, even though the aspect mode is on "keep"
6. Minimize the window or click fullscreen again. There are now back bars on a normal, minimized window that cover up the whole screen.
### Minimal reproduction project (MRP)
This file has only the necessary components. It's a bit over 10mb (10.5) since a texture is needed for the border.
https://drive.google.com/file/d/1LeEdl_bnLN5ZJ25cw62o6NsN-042Hbw8/view?usp=sharing
Contributor guide
Research direction
Start with the linked minimal reproduction project and follow the six listed steps while changing integer scaling, stretch mode, fullscreen, and maximized window state. Compare the rendering state after each transition; done means switching modes and fullscreen no longer leaves black bars on fullscreen or windowed views.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- computer-graphics, game-dev
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100