Conversation
e7dc8f4 to
c977a2b
Compare
Nostritius
left a comment
There was a problem hiding this comment.
I have added some comments with some things that sticked to my eye. I will will make a full review, when you request it.
I am currently working on a big update on the renderer, where the screen size is important (It's about lightning in the scene). Do you want me to push this first or wait for your PR?
|
Thank you for your feedback. I hope to get to it soon enough.
You should definitely go along with your plans. Unfortunately, I still don't have much time to work on this PR for personal reasons, so this might take a while. |
c977a2b to
b7b99e3
Compare
|
Alright, looks like this PR was able to withstand a rebase with a couple of merges. Good to know that's possible. I managed to get down to the reason why fullscreen didn't scale properly for me: as it turns out, as of GLFW 3.3.8 fullscreen apps in Wayland use a system-wide resolution no matter what, meaning that calling glfwSetWindowSize() and alike while the window is in fullscreen mode does nothing. I've tried to remedy this by introducing scaling, but ran into some weird behavior: while GUI does seem to scale correctly, the world itself still tries to render with as much quality as possible. Edit: here's an example of the behavior I'm talking about: ScreenshotRunning OpenAWE on Wayland. `resolution.xml` is set to 640x360 fullscreen while the screen resolution is 1920x1080. Also, I forgot to mention in the commit message that now configuration code treats 0x0 resolution (usually left by latest commits in the config) as unknown, which should be a touch better handling. |
Nostritius
left a comment
There was a problem hiding this comment.
I have tested the code in a wayland environment and noticed the same problem. Stupidly it seems wayland does not want to support modesetting (Changing the resolution of the screen). Maybe you can even check if wayland is used by the $XDG_SESSION_TYPE environment variable. Take into account that this is also a problem in Xwayland. Another option would be to just force the user to the screens resolution and print a warning about it. But I admit that having true modesetting available in wayland is a plus. It can take pressure from the gpu as I noticed myself with a 4k screen and a rather old nvidia gpu. It might be possible over changing the screens resolution in the same way as the settings app does?. Just my thoughts on the matter.
| #include <locale> | ||
| #include <regex> | ||
|
|
||
| #include <GLFW/glfw3.h> |
There was a problem hiding this comment.
This include should not appear outside the platform library
| #include <GLFW/glfw3.h> | ||
|
|
||
| #include "src/common/platform.h" | ||
| #include "src/common/exception.h" |
There was a problem hiding this comment.
I think this was only used for the monitor function, so it could be removed as well
| void drawFrame() override; | ||
|
|
||
| void setRenderPlane(unsigned int width, unsigned int height) override; | ||
| void setRenderPlane(glm::vec2 size) override; |
There was a problem hiding this comment.
Please rename also these methods to setRenderPlane
| void Window::setFullscreen(bool fullscreen) { | ||
| unsigned int width, height; | ||
| getSize(width, height); | ||
| glfwSetWindowMonitor(_window, fullscreen ? glfwGetPrimaryMonitor() : NULL, 0, 0, width, height, GLFW_DONT_CARE); |
There was a problem hiding this comment.
Please use nullptr instead of NULL for uniformity
src/graphics/opengl/framebuffer.cpp
Outdated
| * along with OpenAWE. If not, see <http://www.gnu.org/licenses/>. | ||
| */ | ||
|
|
||
| #include <algorithm> |
| const GLenum framebufferStatus = glCheckFramebufferStatus(GL_FRAMEBUFFER); | ||
|
|
||
| if (framebufferStatus != GL_FRAMEBUFFER_COMPLETE) | ||
| throw CreateException("Failed to initialize framebuffer: {}", framebufferStatus); |
There was a problem hiding this comment.
Is there a reason why you split up the framebuffer status?
There was a problem hiding this comment.
It was not specifically splitting, I was just outputting the error code in the exception message. I'll revert this change - it doesn't have to be here.
| assert(glGetError() == GL_NO_ERROR); | ||
| } | ||
|
|
||
| void Renderer::setRenderPlane(unsigned int width, unsigned int height) { |
There was a problem hiding this comment.
Change this to SetViewportSize
| setRenderPlane(glm::vec2(width, height)); | ||
| } | ||
|
|
||
| void Renderer::setRenderPlane(const glm::vec2 size) { |
There was a problem hiding this comment.
Change this to SetViewportSize
| class Context { | ||
| public: | ||
| virtual void getSize(unsigned int &width, unsigned int &height) = 0; | ||
| virtual glm::vec2 getSize() = 0; |
There was a problem hiding this comment.
Do we need this method? I would prefer having the context interface to be designed in a minimal and concise way and if necessary convert it somewhere else to float
| _window->setFullscreen(config.resolution.fullscreen); | ||
| _window->setSize(config.resolution.width, config.resolution.height); | ||
| spdlog::error("Window size: {} x {}", _window->getSize().x, _window->getSize().y); | ||
| spdlog::error("Content scale: {} x {}", _window->getContentScale().x, _window->getContentScale().y); |
There was a problem hiding this comment.
Note to self - remove these log messages as well
Also writes resolution.xml based of user's current video mode if absent Note: fullscreen scaling for lower resolutions is still wrong, needs fixing
- Add content scaling (because of how Wayland does fullscreen) - Rename _renderPlane to _viewportSize - Move getPrimaryMonitorVideoMode to Platform - Remove setSize/Fullscreen from Context
b7b99e3 to
7885ff9
Compare

This PR's goal is to make OpenAWE read resolution.xml, which it currently only writes zeroes to, and use it to actually resize the window and make it fullscreen if specified. Also adds defaults for resolution.xml based of user's current video mode if file is absent.
This is a draft PR now because fullscreen scaling for lower resolutions is wrong (doesn't stretch to the full screen) and needs fixing before being useful. Windowed mode works fine:
Screenshot: OpenAWE running at 1280x720
Note: check if you have pre-existing resolution.xml before running. Most likely, it's filled with zeroes - change those to the desired resolution, or OpenAWE will crash.