Regarding this PR
Can window size be greater than frame buffer resolution?
For example something like:
I was expecting this to scale the window to fit the specified size (1280x720) while preserving the frame buffer resolution at 640x480 but looks like behind the scene it resizes the frame buffer to be the same as the window size instead of scaling the window. (?)
Am I missing something?
Yeah, that’s right. The default framebuffer size is chosen by the windows manager.
This was some sort of workaround to not break current apps and make them work properly on macos, but you are supposed to set only window size. Maybe the setResolution/setWidth/setHeight methods should be marked as @Deprecated
Is there a way to disable this? so I can resize the window without changing the frame buffer size.
I don’t think so, maybe with glfwGetWindowContentScale you can do something, but seeing how mac is handling this i wouldn’t be surprised if it had some weird side effects on some platforms.
For your use case you could render on an offscreen framebuffer and then copy its content to the default framebuffer, in this way you can have the resolution you want
From the OpenGL wiki:
The default framebuffer contains a number of images, based on how it was created. All default framebuffer images are automatically resized to the size of the output window, as it is resized.
I see. Thanks so much for the help.
Yes, JME has a limitation between Screen size and canvas size. They can be different in opengl but not in JME, it is forced to the same size no matter what in the code.
You could create a frame buffer to any size you want and then render that to a texture and scale it as needed.
It works out great. I do this on many of my games to control screen view, to get around JME limitations.
You can do this for the guiNode or the rootNode or both. I have game that do one or the other or both.
Crossy Roads does it for GUI.
Wolfstien clone does it for GUI
1942 does both rootNode and Gui.
Alternate Reality does both also.
All of them work well and no matter what the screen resolution is, you can control resolution, scaling, view distance in 3d port.
The scaling is simple, just do math to figure out the height between your picture and screen size to see what the scaling should be and give your texture node that scale.