glutin_window
glutin_window copied to clipboard
fullscreen take size from setting
When I create a window with those settings :
WindowSettings::new("Glutin Window", (640, 480))
.fullscreen(true)
The window is fullscreen but in the resolution 640x480. Is this the correct behavior ? I would have preferred being in the default resolution of the screen.
If this is a bug then the correction would be:
fn builder_from_settings(settings: &WindowSettings) -> glutin::WindowBuilder {
let opengl = settings.get_maybe_opengl().unwrap_or(OpenGL::V3_2);
let (major, minor) = opengl.get_major_minor();
let size = settings.get_size();
let mut builder = glutin::WindowBuilder::new()
//.with_dimensions(size.width, size.height) // <---- deleted
.with_decorations(settings.get_decorated())
.with_multitouch()
.with_gl(GlRequest::Specific(Api::OpenGl, (major as u8, minor as u8)))
.with_title(settings.get_title())
.with_srgb(Some(settings.get_srgb()));
let samples = settings.get_samples();
if settings.get_fullscreen() {
builder = builder.with_fullscreen(glutin::get_primary_monitor());
} else {
builder = builder.with_dimensions(size.width, size.height); // <---- added
}
if settings.get_vsync() {
builder = builder.with_vsync();
}
if samples != 0 {
builder = builder.with_multisampling(samples as u16);
}
builder
}
Yes, this is correct behavior. The resolution in full screen, if you want to match it with the screen, requires receiving the resolution from the screen using Glutin and then feed it to WindowSettings.
The reason is that some games lower resolution in full screen mode.
I am experiencing a very strange behaviour on sway (wayland tiling window manager) possible due to that.
(the blue rectangle is the actual borders of the window)
Also the fullscreen just dues the same stuff that would happen for oversized window.
Is there a way of updating the size of the "scene" (viewport?) to match that of the window?
The window_size and viewport passed via RenderArgs seem to be correct.