From 55a57a10368b60a5dbe558d077c5d1c7e509bf2f Mon Sep 17 00:00:00 2001 From: Alug Date: Tue, 12 May 2026 20:48:30 +0200 Subject: [PATCH] fix checking for fbo completeness too early this should come after everything apparently all this shit really needs to be cleaned up again --- src/hardware/r_opengl/r_opengl.c | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/src/hardware/r_opengl/r_opengl.c b/src/hardware/r_opengl/r_opengl.c index 518181f69..c8d60871b 100644 --- a/src/hardware/r_opengl/r_opengl.c +++ b/src/hardware/r_opengl/r_opengl.c @@ -3260,14 +3260,6 @@ static void GL_Framebuffer_Generate(void) if (!framebufferobject.fboobj) pglGenFramebuffers(1, &framebufferobject.fboobj); - if (pglCheckFramebufferStatus(GL_FRAMEBUFFER_EXT) != GL_FRAMEBUFFER_COMPLETE_EXT) - { - // if this fails, dont retry it a gazillion times - // this wouldnt recover - supportFBO = false; - return; - } - // Bind the framebuffer pglBindFramebuffer(GL_FRAMEBUFFER_EXT, framebufferobject.fboobj); @@ -3319,6 +3311,18 @@ static void GL_Framebuffer_Generate(void) pglBindRenderbuffer(GL_RENDERBUFFER_EXT, 0); } + if (pglCheckFramebufferStatus(GL_FRAMEBUFFER_EXT) != GL_FRAMEBUFFER_COMPLETE_EXT) + { + //pglGetError(); TODO:implement this or smth + GL_MSG_Error("GL_Framebuffer_Generate: Failed to create Framebuffer Object"); + + // if this fails, dont retry it a gazillion times + // this wouldnt recover + supportFBO = false; + pglBindFramebuffer(GL_FRAMEBUFFER_EXT, 0); + return; + } + // Unbind the framebuffer pglBindFramebuffer(GL_FRAMEBUFFER_EXT, 0); @@ -3341,6 +3345,10 @@ void GL_Framebuffer_Enable(void) GL_Framebuffer_Generate(); + // failed + if (!supportFBO || !framebufferobject.init) + return; + pglBindFramebuffer(GL_FRAMEBUFFER_EXT, framebufferobject.fboobj); pglBindRenderbuffer(GL_RENDERBUFFER_EXT, framebufferobject.rboobj); }