opengl: use SDL_WINDOW_FULLSCREEN_DESKTOP and an FBO.#437
Merged
Lgt2x merged 1 commit intoDescentDevelopers:mainfrom Jun 15, 2024
Merged
opengl: use SDL_WINDOW_FULLSCREEN_DESKTOP and an FBO.#437Lgt2x merged 1 commit intoDescentDevelopers:mainfrom
Lgt2x merged 1 commit intoDescentDevelopers:mainfrom
Conversation
Contributor
Author
|
(Sorry this took so long to get around to! Also, this has only had extremely light testing here after I merged it into this codebase, so please feel free to try it out and let me know if something is hosed and I'll fix things up.) |
1795870 to
f6365d0
Compare
This now renders to an OpenGL Framebuffer Object at the game's resolution, and blits it to the window at whatever resolution it is currently using, scaling and letterboxing if necessary. Which is to say: display resolutions are now imaginary, and we never change the physical display mode now. A smaller resolution is simply drawing less pixels and scaling them up with the GPU for display. This solves a few problems: no more resizing background windows or desktop icons shuffling around, no more being stuck in a weird resolution when debugging or if the game crashes, no more waiting on monitors to click over to a new mode, and no more weird rendering when the display didn't exactly support the requested mode. This also means the game doesn't have to drop down to 640x480 for the config menu screen when it was otherwise using some other resolution. Some caveats: - This _requires_ OpenGL Framebuffer Object support; there is currently no fallback if it's missing and the game will refuse to start. But any desktop hardware of the last ~20 years should support it. For weird embedded things or whatnot, it will be possible to add a fallback. - This currently requires SDL. The OpenGL pieces should work on Windows, but someone would need to adjust the existing win32 code to create a fullscreen window and not change the physical display mode. It should still compile on windows and work as before (untested by me, though). - This is only OpenGL; it does not touch the Direct3D renderer, which should continue to work as before (again, untested by me).
f6365d0 to
393a39b
Compare
bryanperris
approved these changes
Jun 14, 2024
Collaborator
|
Tested on Linux, works fine. |
1 task
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This now renders to an OpenGL Framebuffer Object at the game's resolution, and blits it to the window at whatever resolution it is currently using, scaling and letterboxing if necessary.
Which is to say: display resolutions are now imaginary, and we never change the physical display mode now. A smaller resolution is simply drawing less pixels and scaling them up with the GPU for display. This solves a few problems: no more resizing background windows or desktop icons shuffling around, no more being stuck in a weird resolution when debugging or if the game crashes, no more waiting on monitors to click over to a new mode, and no more weird rendering when the display didn't exactly support the requested mode.
This also means the game doesn't have to drop down to 640x480 for the config menu screen when it was otherwise using some other resolution.
Some caveats:
This requires OpenGL Framebuffer Object support; there is currently no fallback if it's missing and the game will refuse to start. But any desktop hardware of the last ~20 years should support it. For weird embedded things or whatnot, it will be possible to add a fallback.
This currently requires SDL. The OpenGL pieces should work on Windows, but someone would need to adjust the existing win32 code to create a fullscreen window and not change the physical display mode. It should still compile on windows and work as before (untested by me, though).
This is only OpenGL; it does not touch the Direct3D renderer, which should continue to work as before (again, untested by me).