From ef27fca1e1041f8eb298d0dab6eed876786b2026 Mon Sep 17 00:00:00 2001 From: LLLL Colonq Date: Fri, 26 Apr 2024 14:26:22 -0400 Subject: Fix lighting, various toggles --- src/context.rs | 31 ++++++++++++++++++++++++++++--- 1 file changed, 28 insertions(+), 3 deletions(-) (limited to 'src/context.rs') diff --git a/src/context.rs b/src/context.rs index db6a2a7..db402a8 100644 --- a/src/context.rs +++ b/src/context.rs @@ -61,8 +61,7 @@ impl Context { gl.enable(glow::STENCIL_TEST); - // gl.enable(glow::CULL_FACE); - // gl.cull_face(glow::FRONT); + gl.cull_face(glow::BACK); } let emptyvao = unsafe { @@ -71,7 +70,6 @@ impl Context { unsafe { js_track_resized_setup(); } - Self { window, gl, @@ -154,4 +152,31 @@ impl Context { self.gl.draw_arrays(glow::TRIANGLE_STRIP, 0, 4); } } + + pub fn reset_blend(&self) { + unsafe { + self.gl.blend_func(glow::SRC_ALPHA, glow::ONE_MINUS_SRC_ALPHA); + } + } + + pub fn inverse_blend(&self) { + unsafe { + self.gl.blend_func( + glow::ONE_MINUS_DST_COLOR, + glow::ZERO, + ); + } + } + + pub fn enable_culling(&self) { + unsafe { + self.gl.enable(glow::CULL_FACE); + } + } + + pub fn disable_culling(&self) { + unsafe { + self.gl.disable(glow::CULL_FACE); + } + } } -- cgit v1.2.3