From 8fa47e961d0d3aa38b29cb431a7f2c2eaaf70f7b Mon Sep 17 00:00:00 2001 From: Gary Talent Date: Wed, 20 Dec 2023 19:14:42 -0600 Subject: [PATCH] [nostalgia/core/opengl] Disable depth testing once core scene is drawn --- src/nostalgia/modules/core/src/opengl/gfx.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/nostalgia/modules/core/src/opengl/gfx.cpp b/src/nostalgia/modules/core/src/opengl/gfx.cpp index eccd1eb9..dfd44156 100644 --- a/src/nostalgia/modules/core/src/opengl/gfx.cpp +++ b/src/nostalgia/modules/core/src/opengl/gfx.cpp @@ -463,9 +463,6 @@ static void setSprite( ox::Error initGfx( Context &ctx, InitParams const&initParams) noexcept { - glEnable(GL_DEPTH_TEST); - glEnable(GL_BLEND); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); const auto bgVshad = ox::sfmt(renderer::bgvshadTmpl, gl::GlslVersion); const auto bgFshad = ox::sfmt(renderer::bgfshadTmpl, gl::GlslVersion); const auto spriteVshad = ox::sfmt(renderer::spritevshadTmpl, gl::GlslVersion); @@ -670,12 +667,17 @@ ox::Size drawSize(int scale) noexcept { void draw(core::Context &ctx, ox::Size const&renderSz) noexcept { glViewport(0, 0, renderSz.width, renderSz.height); + glEnable(GL_DEPTH_TEST); + glEnable(GL_BLEND); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glClearColor(0, 0, 0, 1); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); renderer::drawBackgrounds(ctx, renderSz); if (ctx.spriteBlocks.tex) { renderer::drawSprites(ctx, renderSz); } + glDisable(GL_DEPTH_TEST); + glDisable(GL_BLEND); } void draw(core::Context &ctx, int scale) noexcept {