summaryrefslogtreecommitdiff
path: root/src/context.rs
diff options
context:
space:
mode:
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);
+ }
+ }
}