From f087bf1f7fc686162764abe72795585a0e61149a Mon Sep 17 00:00:00 2001 From: veclavtalica Date: Mon, 14 Oct 2024 16:00:27 +0300 Subject: [PATCH] fix depth clearing, ghostly modes not using depth layers, ortho with 0..1 --- src/rendering/twn_gl_15_rendering.c | 4 ++-- src/rendering/twn_gl_any_rendering.c | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/rendering/twn_gl_15_rendering.c b/src/rendering/twn_gl_15_rendering.c index efb82dd..894c1ac 100644 --- a/src/rendering/twn_gl_15_rendering.c +++ b/src/rendering/twn_gl_15_rendering.c @@ -159,7 +159,7 @@ void use_2d_pipeline(void) { glMatrixMode(GL_PROJECTION); glLoadIdentity(); - glOrtho(0, (double)ctx.base_render_width, (double)ctx.base_render_height, 0, -1, 1); + glOrtho(0, (double)ctx.base_render_width, (double)ctx.base_render_height, 0, 0, 1); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); @@ -211,7 +211,7 @@ void use_texture_mode(TextureMode mode) { glNewList(lists + 0, GL_COMPILE); { glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glDepthFunc(GL_ALWAYS); + glDepthFunc(GL_LESS); glDepthMask(GL_FALSE); glDisable(GL_ALPHA_TEST); } glEndList(); diff --git a/src/rendering/twn_gl_any_rendering.c b/src/rendering/twn_gl_any_rendering.c index 77a7138..c3d0b30 100644 --- a/src/rendering/twn_gl_any_rendering.c +++ b/src/rendering/twn_gl_any_rendering.c @@ -71,6 +71,9 @@ void clear_draw_buffer(void) { (1.0f / 255) * 230, (1.0f / 255) * 230, 1); + glDepthRange(0.0, 1.0); + glDepthMask(GL_TRUE); + /* TODO: don't clear color when skybox is applied? */ /* for that window should match framebuffer */ /* also it is driver dependent, from what i can gather */