From 198dfb088e08b634ff898c0faece44fa2134c8a4 Mon Sep 17 00:00:00 2001 From: griffi-gh Date: Wed, 22 Nov 2023 17:07:55 +0100 Subject: [PATCH] fix missing depth buffer (like wtf) --- kubi/src/rendering.rs | 10 ++++++++-- kubi/src/settings.rs | 2 +- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/kubi/src/rendering.rs b/kubi/src/rendering.rs index 6c0e960..3e58741 100644 --- a/kubi/src/rendering.rs +++ b/kubi/src/rendering.rs @@ -12,7 +12,9 @@ use glutin::{ context::ContextAttributesBuilder, surface::{WindowSurface, SurfaceAttributesBuilder}, display::GetGlDisplay, + config::ConfigTemplateBuilder }; +use glutin_winit::DisplayBuilder; use glam::{Vec3, UVec2}; use crate::{events::WindowResizedEvent, settings::{GameSettings, FullscreenMode}}; @@ -90,8 +92,12 @@ impl Renderer { }); // First we start by opening a new Window - let display_builder = glutin_winit::DisplayBuilder::new().with_window_builder(Some(wb)); - let config_template_builder = glutin::config::ConfigTemplateBuilder::new(); + let display_builder = DisplayBuilder::new().with_window_builder(Some(wb)); + let config_template_builder = ConfigTemplateBuilder::new() + .prefer_hardware_accelerated(Some(true)) + .with_depth_size(24) + .with_multisampling(settings.msaa.unwrap_or_default()) + .with_transparency(false); let (window, gl_config) = display_builder .build(event_loop, config_template_builder, |mut configs| { configs.next().unwrap() diff --git a/kubi/src/settings.rs b/kubi/src/settings.rs index c20fe53..e2d568d 100644 --- a/kubi/src/settings.rs +++ b/kubi/src/settings.rs @@ -13,7 +13,7 @@ pub struct FullscreenSettings { pub struct GameSettings { pub vsync: bool, pub fullscreen: Option, - pub msaa: Option, + pub msaa: Option, pub max_anisotropy: Option, /// there's a 1 chunk border of loaded but invisible around this pub render_distance: u8,