From 1b82ef05563c778cf1d9b31b440411a484082bb6 Mon Sep 17 00:00:00 2001 From: Warwick Date: Thu, 21 Apr 2022 13:36:46 +0100 Subject: [PATCH] Enabled GL Deph buffor so things render in correct order. --- src/main.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main.cpp b/src/main.cpp index 0047ed0..c87b3a5 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -184,8 +184,13 @@ int main(int argc, char **argv) { glm::mat4 Projection = glm::perspective( glm::radians(45.0f), (float)width / (float)height, 0.1f, 100.0f); + // Create player camera object PlayerCamera camera; + // Enable Render order things don't render in front of the wrong objects + glEnable(GL_DEPTH_TEST); + glClearColor(0.0f, 0.0f, 0.0f, 0.0f); + // Game loop bool running = true; while (running) { @@ -200,7 +205,6 @@ int main(int argc, char **argv) { camera.tick(); // Clear screen ready for next loop - glClearColor(0.0f, 0.0f, 0.0f, 0.0f); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // Make every shader/rendering call from this point on use our shader // glUseProgram(shaderProgram);