From ea664944bb15f63ae40ac9031071b33583d3faa7 Mon Sep 17 00:00:00 2001 From: veclavtalica Date: Tue, 30 Jul 2024 21:43:08 +0300 Subject: [PATCH] set depth range for 3d, flush 3d before starting with 2d --- src/main.c | 1 + src/rendering.c | 2 ++ 2 files changed, 3 insertions(+) diff --git a/src/main.c b/src/main.c index bea2f84..d5be625 100644 --- a/src/main.c +++ b/src/main.c @@ -192,6 +192,7 @@ static bool initialize(void) { SDL_GL_SetAttribute(SDL_GL_ALPHA_SIZE, 0); SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 16); SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1); + SDL_GL_SetAttribute(SDL_GL_ACCELERATED_VISUAL, 1); if (ctx.debug) SDL_GL_SetAttribute(SDL_GL_CONTEXT_FLAGS, SDL_GL_CONTEXT_DEBUG_FLAG); diff --git a/src/rendering.c b/src/rendering.c index 973afa3..ec2fa6b 100644 --- a/src/rendering.c +++ b/src/rendering.c @@ -113,6 +113,7 @@ static void render_space(void) { glEnable(GL_DEPTH_TEST); glDepthMask(GL_TRUE); glDepthFunc(GL_LESS); + glDepthRange(0, 1); glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glEnable(GL_TEXTURE_2D); @@ -175,6 +176,7 @@ void render(void) { /* TODO: only do it when transition between spaces is needed */ glClear(GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT); + glFlush(); { glMatrixMode(GL_PROJECTION);