Compare commits

...

2 commits

Author SHA1 Message Date
griffi-gh 3f8056b6ea always request gles3 2024-05-03 14:01:05 +02:00
griffi-gh b596deeaed hopefully fix trans rendering bug 2024-05-03 13:36:22 +02:00
2 changed files with 21 additions and 22 deletions

View file

@ -6,13 +6,9 @@ use winit::{
window::{WindowBuilder, Fullscreen, Window},
dpi::PhysicalSize
};
use glium::{Display, Surface, Version, Api};
use glium::{Display, Surface, Version, Api as GlApiTy};
use glutin::{
prelude::*,
context::{ContextAttributesBuilder, GlProfile},
surface::{WindowSurface, SurfaceAttributesBuilder},
display::GetGlDisplay,
config::ConfigTemplateBuilder
config::{Api, ConfigTemplateBuilder}, context::{ContextAttributesBuilder, GlProfile}, display::GetGlDisplay, prelude::*, surface::{SurfaceAttributesBuilder, WindowSurface}
};
use glutin_winit::DisplayBuilder;
use glam::{Vec3, UVec2};
@ -96,6 +92,7 @@ impl Renderer {
.with_window_builder(Some(wb));
let config_template_builder = ConfigTemplateBuilder::new()
.with_api(Api::GLES3)
.prefer_hardware_accelerated(Some(true))
.with_depth_size(24)
.with_multisampling(settings.msaa.unwrap_or_default());
@ -156,7 +153,7 @@ impl Renderer {
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)), "GLSL ES 3.0 is not supported");
assert!(display.is_glsl_version_supported(&Version(GlApiTy::GlEs, 3, 0)), "GLSL ES 3.0 is not supported");
Self { window, display }
}

View file

@ -76,7 +76,7 @@ pub fn draw_world(
let world_position = position.as_vec3() * CHUNK_SIZE as f32;
//Skip mesh if its empty
if mesh.index_buffer.len() == 0 {
if mesh.index_buffer.len() == 0 && mesh.trans_index_buffer.len() == 0 {
continue
}
@ -90,6 +90,7 @@ pub fn draw_world(
}
//Draw chunk mesh
if mesh.index_buffer.len() > 0 {
target.0.draw(
&mesh.vertex_buffer,
&mesh.index_buffer,
@ -103,6 +104,7 @@ pub fn draw_world(
},
&draw_parameters
).unwrap();
}
if mesh.trans_index_buffer.len() > 0 {
enqueue_trans.push((chunk, mesh));