FramebuffersGL 3.0

glCheckFramebufferStatus

Checks that the bound framebuffer is complete (usable for rendering).

Signature

GLenum glCheckFramebufferStatus(GLenum target);

How it works

An FBO is only usable when its attachments are compatible: at least one attachment, all with the same number of samples, formats that can be rendered to, and so on. Call this after setting up the attachments; if it does not return GL_FRAMEBUFFER_COMPLETE, drawing into it will fail.

Parameters

targetGLenum

GL_FRAMEBUFFER, GL_DRAW_FRAMEBUFFER or GL_READ_FRAMEBUFFER.

Return value

GL_FRAMEBUFFER_COMPLETE on success. Otherwise a reason, e.g. GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT, GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT, GL_FRAMEBUFFER_UNSUPPORTED, GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE.

Example

example.cpp
1if (glCheckFramebufferStatus(GL_FRAMEBUFFER) != GL_FRAMEBUFFER_COMPLETE)
2    std::fprintf(stderr, "Framebuffer is not complete!\n");
3glBindFramebuffer(GL_FRAMEBUFFER, 0);
Official Khronos documentation