From 47798568f3f05b8267ae3700369a4a396073ef97 Mon Sep 17 00:00:00 2001 From: HampusM Date: Wed, 25 Oct 2023 20:31:56 +0200 Subject: feat(engine): enable depth testing --- engine/src/renderer/mod.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'engine/src/renderer/mod.rs') 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(); -- cgit v1.2.3-18-g5258