diff options
author | 2020-05-22 19:15:39 +0200 | |
---|---|---|
committer | 2020-05-22 19:15:39 +0200 | |
commit | 1dd79c4697ce39589bea84142334b3cbd242fb59 (patch) | |
tree | 680c0c769217bb706046f91521aa94ae78cd80bb /glow/src/window | |
parent | 6f71a8e3d5e47ab05653315b0d44b35af6a20338 (diff) | |
download | iced-1dd79c4697ce39589bea84142334b3cbd242fb59.tar.gz iced-1dd79c4697ce39589bea84142334b3cbd242fb59.tar.bz2 iced-1dd79c4697ce39589bea84142334b3cbd242fb59.zip |
Use built-in OpenGL multisampling in `iced_glow`
Diffstat (limited to 'glow/src/window')
-rw-r--r-- | glow/src/window/compositor.rs | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/glow/src/window/compositor.rs b/glow/src/window/compositor.rs index 1117166f..2f504ff7 100644 --- a/glow/src/window/compositor.rs +++ b/glow/src/window/compositor.rs @@ -2,7 +2,7 @@ use crate::{Backend, Renderer, Settings, Viewport}; use core::ffi::c_void; use glow::HasContext; -use iced_graphics::Size; +use iced_graphics::{Antialiasing, Size}; use iced_native::mouse; /// A window graphics backend for iced powered by `glow`. @@ -30,11 +30,21 @@ impl iced_graphics::window::GLCompositor for Compositor { gl.enable(glow::BLEND); gl.blend_func(glow::SRC_ALPHA, glow::ONE_MINUS_SRC_ALPHA); + // Disable multisampling by default + gl.disable(glow::MULTISAMPLE); + let renderer = Renderer::new(Backend::new(&gl, settings)); (Self { gl }, renderer) } + fn sample_count(settings: &Settings) -> u32 { + settings + .antialiasing + .map(Antialiasing::sample_count) + .unwrap_or(0) + } + fn resize_viewport(&mut self, physical_size: Size<u32>) { unsafe { self.gl.viewport( |