diff options
author | hnOsmium0001 <[email protected]> | 2022-05-07 18:58:25 -0700 |
---|---|---|
committer | hnOsmium0001 <[email protected]> | 2022-05-07 18:58:25 -0700 |
commit | eb4e202ee8d6e32aebf252cc107f6ec8dfd75b8f (patch) | |
tree | 50ced48f540b6b31275a2fc318a9c26cd54a9ec1 /source | |
parent | 96d935efe79cb4ab954f1e76d5e48878f4e3599e (diff) |
Enable OpenGL depth testing
Diffstat (limited to 'source')
-rw-r--r-- | source/main.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/source/main.cpp b/source/main.cpp index 1437c4f..592350f 100644 --- a/source/main.cpp +++ b/source/main.cpp @@ -359,6 +359,10 @@ void main() { App app; glfwUserData.app = &app; + // NOTE: don't enable backface culling, because the game mainly runs in 2D and sometimes we'd like to flip sprites around + // it also helps with debugging layers in 3D view + glEnable(GL_DEPTH_TEST); + // 60 updates per second constexpr double kMsPerUpdate = 1000.0 / 60; constexpr double kSecondsPerUpdate = kMsPerUpdate / 1000; @@ -403,7 +407,7 @@ void main() { glViewport(0, 0, fbWidth, fbHeight); auto clearColor = ImVec4(0.45f, 0.55f, 0.60f, 1.00f); glClearColor(clearColor.x * clearColor.w, clearColor.y * clearColor.w, clearColor.z * clearColor.w, clearColor.w); - glClear(GL_COLOR_BUFFER_BIT); + glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); { // Regular draw ZoneScopedN("Render"); |