better fbo building error printing

This commit is contained in:
Green Sky 2022-02-19 00:56:16 +01:00
parent c48ae81238
commit e39b23ac72

View File

@ -18,10 +18,30 @@ FBOBuilder FBOBuilder::start(void) {
} }
std::shared_ptr<FrameBufferObject> FBOBuilder::finish(void) { std::shared_ptr<FrameBufferObject> FBOBuilder::finish(void) {
if (glCheckFramebufferStatus(GL_FRAMEBUFFER) == GL_FRAMEBUFFER_COMPLETE) { const auto status = glCheckFramebufferStatus(GL_FRAMEBUFFER);
if (status == GL_FRAMEBUFFER_COMPLETE) {
return _fbo; return _fbo;
} }
const char* error_str = "UNK";
switch (status) {
case GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT:
error_str = "GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT";
break;
#ifdef MM_OPENGL_3_GLES
case GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS:
error_str = "GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS";
break;
#endif
case GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT:
error_str = "GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT";
break;
case GL_FRAMEBUFFER_UNSUPPORTED:
error_str = "GL_FRAMEBUFFER_UNSUPPORTED";
break;
}
SPDLOG_ERROR("framebuffer status: {}", error_str);
return nullptr; return nullptr;
} }