add vsync option

This commit is contained in:
griffi-gh 2023-05-16 12:20:09 +02:00
parent c142b2fd47
commit 33a5b8c6ef
2 changed files with 9 additions and 8 deletions

View file

@ -74,6 +74,7 @@ impl Renderer {
let cb = ContextBuilder::new()
.with_depth_buffer(24)
.with_multisampling(settings.msaa.unwrap_or_default())
.with_vsync(settings.vsync)
.with_gl_profile(GlProfile::Core);
let display = Display::new(wb, cb, event_loop)
@ -81,14 +82,12 @@ impl Renderer {
log::info!("Vendor: {}", display.get_opengl_vendor_string());
log::info!("Renderer: {}", display.get_opengl_renderer_string());
log::info!("OpenGL {}", display.get_opengl_version_string());
log::info!("Supports GLSL {:?}", display.get_supported_glsl_version());
if display.is_context_loss_possible() {
log::warn!("ogl context loss possible");
}
if display.is_robust() {
log::warn!("ogl implementation is not robust");
}
log::info!("OpenGL: {}", display.get_opengl_version_string());
log::info!("Supports GLSL: {:?}", display.get_supported_glsl_version());
log::info!("Framebuffer dimensions: {:?}", display.get_framebuffer_dimensions());
if display.is_context_loss_possible() { log::warn!("OpenGL context loss possible") }
if display.is_robust() { log::warn!("OpenGL implementation is not robust") }
if display.is_debug() { log::info!("OpenGL context is in debug mode") }
assert!(display.is_glsl_version_supported(&Version(Api::GlEs, 3, 0)), "GLES 3.0 is not supported");

View file

@ -11,6 +11,7 @@ pub struct FullscreenSettings {
#[derive(Unique)]
pub struct GameSettings {
pub vsync: bool,
pub fullscreen: Option<FullscreenSettings>,
pub msaa: Option<u16>,
pub max_anisotropy: Option<u16>,
@ -22,6 +23,7 @@ pub struct GameSettings {
impl Default for GameSettings {
fn default() -> Self {
Self {
vsync: false,
fullscreen: None,
msaa: Some(4), //not used yet
max_anisotropy: Some(16),