| 40 | } |
| 41 | |
| 42 | static QString formatFramebufferStatus(GLenum status) |
| 43 | { |
| 44 | switch (status) { |
| 45 | case GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT: |
| 46 | // An attachment is the wrong type / is invalid / has 0 width or height |
| 47 | return QStringLiteral("GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT"); |
| 48 | case GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT: |
| 49 | // There are no images attached to the framebuffer |
| 50 | return QStringLiteral("GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT"); |
| 51 | case GL_FRAMEBUFFER_UNSUPPORTED: |
| 52 | // A format or the combination of formats of the attachments is unsupported |
| 53 | return QStringLiteral("GL_FRAMEBUFFER_UNSUPPORTED"); |
| 54 | case GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT: |
| 55 | // Not all attached images have the same width and height |
| 56 | return QStringLiteral("GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT"); |
| 57 | case GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT: |
| 58 | // The color attachments don't have the same format |
| 59 | return QStringLiteral("GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT"); |
| 60 | case GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_EXT: |
| 61 | // The attachments don't have the same number of samples |
| 62 | return QStringLiteral("GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE"); |
| 63 | case GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_EXT: |
| 64 | // The draw buffer is missing |
| 65 | return QStringLiteral("GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER"); |
| 66 | case GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER_EXT: |
| 67 | // The read buffer is missing |
| 68 | return QStringLiteral("GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER"); |
| 69 | default: |
| 70 | return QStringLiteral("Unknown (0x") + QString::number(status, 16) + QStringLiteral(")"); |
| 71 | } |
| 72 | } |
| 73 | |
| 74 | GLFramebuffer::GLFramebuffer(GLTexture *colorAttachment, Attachment attachment) |
| 75 | : m_size(colorAttachment->size()) |