diff options
author | HampusM <hampus@hampusmat.com> | 2023-10-25 20:31:56 +0200 |
---|---|---|
committer | HampusM <hampus@hampusmat.com> | 2023-10-25 20:32:00 +0200 |
commit | 47798568f3f05b8267ae3700369a4a396073ef97 (patch) | |
tree | 9219faefd05f2a4c659e5b51c69740c9ecf60929 /engine/src/renderer/mod.rs | |
parent | 3d0de3f951ec2da7a2d41c6958d0d3583a7832a0 (diff) |
feat(engine): enable depth testing
Diffstat (limited to 'engine/src/renderer/mod.rs')
-rw-r--r-- | engine/src/renderer/mod.rs | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/engine/src/renderer/mod.rs b/engine/src/renderer/mod.rs index aa828fe..4dcc075 100644 --- a/engine/src/renderer/mod.rs +++ b/engine/src/renderer/mod.rs @@ -16,7 +16,7 @@ use crate::opengl::buffer::{ use crate::opengl::debug::{MessageSeverity, MessageSource, MessageType}; use crate::opengl::shader::Program as ShaderProgram; use crate::opengl::vertex_array::{PrimitiveKind, VertexArray}; -use crate::opengl::{clear_buffers, BufferClearMask}; +use crate::opengl::{clear_buffers, enable, BufferClearMask, Capability}; use crate::projection::new_perspective; use crate::vector::Vec2; use crate::vertex::Vertex; @@ -59,6 +59,8 @@ pub fn initialize(window: &glfw::Window) -> Result<(), Error> set_viewport(&Vec2 { x: 0, y: 0 }, &window_size); + enable(Capability::DepthTest); + Ok(()) } @@ -107,7 +109,7 @@ pub fn render<'obj>( camera: &Camera, ) { - clear_buffers(BufferClearMask::COLOR); + clear_buffers(BufferClearMask::COLOR | BufferClearMask::DEPTH); for obj in objects { obj.renderable().shader_program.activate(); |