fix missing depth buffer (like wtf)

This commit is contained in:
griffi-gh 2023-11-22 17:07:55 +01:00
parent 6e0d93c23e
commit d4d7066526
2 changed files with 9 additions and 3 deletions

View file

@ -12,7 +12,9 @@ use glutin::{
context::ContextAttributesBuilder, context::ContextAttributesBuilder,
surface::{WindowSurface, SurfaceAttributesBuilder}, surface::{WindowSurface, SurfaceAttributesBuilder},
display::GetGlDisplay, display::GetGlDisplay,
config::ConfigTemplateBuilder
}; };
use glutin_winit::DisplayBuilder;
use glam::{Vec3, UVec2}; use glam::{Vec3, UVec2};
use crate::{events::WindowResizedEvent, settings::{GameSettings, FullscreenMode}}; use crate::{events::WindowResizedEvent, settings::{GameSettings, FullscreenMode}};
@ -90,8 +92,12 @@ impl Renderer {
}); });
// First we start by opening a new Window // First we start by opening a new Window
let display_builder = glutin_winit::DisplayBuilder::new().with_window_builder(Some(wb)); let display_builder = DisplayBuilder::new().with_window_builder(Some(wb));
let config_template_builder = glutin::config::ConfigTemplateBuilder::new(); 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 let (window, gl_config) = display_builder
.build(event_loop, config_template_builder, |mut configs| { .build(event_loop, config_template_builder, |mut configs| {
configs.next().unwrap() configs.next().unwrap()

View file

@ -13,7 +13,7 @@ pub struct FullscreenSettings {
pub struct GameSettings { pub struct GameSettings {
pub vsync: bool, pub vsync: bool,
pub fullscreen: Option<FullscreenSettings>, pub fullscreen: Option<FullscreenSettings>,
pub msaa: Option<u16>, pub msaa: Option<u8>,
pub max_anisotropy: Option<u16>, pub max_anisotropy: Option<u16>,
/// there's a 1 chunk border of loaded but invisible around this /// there's a 1 chunk border of loaded but invisible around this
pub render_distance: u8, pub render_distance: u8,