aboutsummaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorrtk0c <[email protected]>2022-05-07 18:58:25 -0700
committerrtk0c <[email protected]>2022-05-07 18:58:25 -0700
commit0816a885c85eebe70d8a3b72c5bf12d56d4b9bff (patch)
treebd73024c6a511535549fe25242f2b433d7057c89 /source
parentffb58d99615beadc67028d52dfeb85358afae40d (diff)
Changeset: 27 Enable OpenGL depth testing
Diffstat (limited to 'source')
-rw-r--r--source/main.cpp6
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");