From ef9e24722ab9125e9cdbec6fa41b01a52d8f4577 Mon Sep 17 00:00:00 2001 From: griffi-gh Date: Mon, 16 Jan 2023 16:32:34 +0100 Subject: [PATCH] use nearest sampler --- src/game.rs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/game.rs b/src/game.rs index c33e694..71aeb1d 100644 --- a/src/game.rs +++ b/src/game.rs @@ -1,4 +1,5 @@ use glium::{Surface, uniform}; +use glium::uniforms::{Sampler, MinifySamplerFilter, MagnifySamplerFilter}; use glium::glutin::{ event::{Event, WindowEvent, DeviceEvent, KeyboardInput, VirtualKeyCode}, event_loop::{EventLoop, ControlFlow}, @@ -57,6 +58,12 @@ pub fn run() { let mut last_render = Instant::now(); + let sampler_nearest = glium::uniforms::SamplerBehavior { + minify_filter: MinifySamplerFilter::Nearest, + magnify_filter: MagnifySamplerFilter::Nearest, + ..Default::default() + }; + event_loop.run(move |event, _, control_flow| { *control_flow = ControlFlow::Poll; match event { @@ -100,6 +107,7 @@ pub fn run() { let perspective = state.camera.perspective_matrix(target_dimensions); let view = state.camera.view_matrix(); target.clear_color_and_depth((0.5, 0.5, 1., 1.), 1.); + target.draw( &vertex_buffer, glium::index::NoIndices(glium::index::PrimitiveType::TrianglesList), @@ -113,7 +121,7 @@ pub fn run() { ], view: view, perspective: perspective, - tex: &assets.textures.block_atlas + tex: Sampler(&assets.textures.block_atlas, sampler_nearest) }, &Default::default() ).unwrap();