diff --git a/src/graphics/core/Framebuffer.cpp b/src/graphics/core/Framebuffer.cpp index bb360b54..73afee97 100644 --- a/src/graphics/core/Framebuffer.cpp +++ b/src/graphics/core/Framebuffer.cpp @@ -3,6 +3,7 @@ #include #include "Texture.hpp" #include "debug/Logger.hpp" +#include "gl_util.hpp" static debug::Logger logger("gl-framebuffer"); @@ -48,8 +49,12 @@ Framebuffer::Framebuffer(uint width, uint height, bool alpha) glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH_COMPONENT24, width, height); glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, depth); - if (glCheckFramebufferStatus(GL_FRAMEBUFFER) != GL_FRAMEBUFFER_COMPLETE) { - logger.error() << "framebuffer is not complete!"; + GLenum status = glCheckFramebufferStatus(GL_FRAMEBUFFER); + if (status != GL_FRAMEBUFFER_COMPLETE) { + auto logLine = logger.error(); + logLine << "framebuffer is not complete: "; + logLine << gl::to_string(status); + logLine << " (" << status << ")"; } glBindFramebuffer(GL_FRAMEBUFFER, 0); diff --git a/src/graphics/core/gl_util.hpp b/src/graphics/core/gl_util.hpp index da2abfb5..75402d4d 100644 --- a/src/graphics/core/gl_util.hpp +++ b/src/graphics/core/gl_util.hpp @@ -45,4 +45,26 @@ namespace gl { } return 0; } + + /// TODO: extend + inline const char* to_string(GLenum item) { + switch (item) { + case GL_FRAMEBUFFER_UNDEFINED: + return "framebuffer undefined"; + case GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT: + return "framebuffer incomplete attachment"; + case GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT: + return "framebuffer incomplete missing attachment"; + case GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER: + return "framebuffer incomplete draw buffer"; + case GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER: + return "framebuffer incomplete read buffer"; + case GL_FRAMEBUFFER_UNSUPPORTED: + return "framebuffer unsupported"; + case GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE: + return "framebuffer incomplete multisample"; + default: + return "unknown"; + } + } }