Default to vsync for OpenGL rendering

Fixes #3516

(cherry picked from commit fd123b27bd)
This commit is contained in:
Simon Hausmann 2023-09-20 11:03:39 +02:00
parent 772a4455f2
commit 80fae1058f
2 changed files with 16 additions and 0 deletions

View file

@ -179,6 +179,14 @@ impl OpenGLContext {
);
}
// Try to default to vsync and ignore if the driver doesn't support it.
surface
.set_swap_interval(
&context,
glutin::surface::SwapInterval::Wait(NonZeroU32::new(1).unwrap()),
)
.ok();
Ok((window, Self { context, surface }))
}
}

View file

@ -340,6 +340,14 @@ impl OpenGLSurface {
.into());
}
// Try to default to vsync and ignore if the driver doesn't support it.
surface
.set_swap_interval(
&context,
glutin::surface::SwapInterval::Wait(NonZeroU32::new(1).unwrap()),
)
.ok();
Ok((context, surface))
}