summaryrefslogtreecommitdiff
path: root/src/context.rs
diff options
context:
space:
mode:
authorLLLL Colonq <llll@colonq>2024-04-26 14:26:22 -0400
committerLLLL Colonq <llll@colonq>2024-04-26 14:26:22 -0400
commitef27fca1e1041f8eb298d0dab6eed876786b2026 (patch)
treee52cc1552cfe982a881505f08fc74f8d0cab40cf /src/context.rs
parentd2f9bfeba00018a1109949eed5a2434a040881fe (diff)
Fix lighting, various toggles
Diffstat (limited to 'src/context.rs')
-rw-r--r--src/context.rs31
1 files changed, 28 insertions, 3 deletions
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);
+ }
+ }
}