Name

glCheckFramebufferStatus, glCheckNamedFramebufferStatus — check the completeness status of a framebuffer

C Specification

​GLenum glCheckFramebufferStatus(​

GLenum target​​)​​;

 

​GLenum glCheckNamedFramebufferStatus(​

GLuint framebuffer,

 

GLenum target​​)​​;

 

Parameters

target

Specify the target to which the framebuffer is bound for ​​glCheckFramebufferStatus​​​, and the target against which framebuffer completeness of ​framebuffer​​ is checked for ​​glCheckNamedFramebufferStatus​​.

framebuffer

Specifies the name of the framebuffer object for ​​glCheckNamedFramebufferStatus​

Description

​glCheckFramebufferStatus​​​ and ​​glCheckNamedFramebufferStatus​​​ return the completeness status of a framebuffer object when treated as a read or draw framebuffer, depending on the value of ​target​.

For ​​glCheckFramebufferStatus​​​, the framebuffer checked is that bound to ​target​​, which must be ​​GL_DRAW_FRAMEBUFFER​​​, ​​GL_READ_FRAMEBUFFER​​​ or ​​GL_FRAMEBUFFER​​​. ​​GL_FRAMEBUFFER​​​ is equivalent to ​​GL_DRAW_FRAMEBUFFER​​.

For ​​glCheckNamedFramebufferStatus​​​, ​framebuffer​​ is zero or the name of the framebuffer object to check. If ​framebuffer​​ is zero, then the status of the default read or draw framebuffer, as determined by ​target​, is returned.

The return value is ​​GL_FRAMEBUFFER_COMPLETE​​ if the specified framebuffer is complete. Otherwise, the return value is determined as follows:

  • ​GL_FRAMEBUFFER_UNDEFINED​​ is returned if the specified framebuffer is the default read or draw framebuffer, but the default framebuffer does not exist.
  • ​GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT​​ is returned if any of the framebuffer attachment points are framebuffer incomplete.
  • ​GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT​​ is returned if the framebuffer does not have at least one image attached to it.
  • ​GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER​​​ is returned if the value of ​​GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE​​ is ​​GL_NONE​​ for any color attachment point(s) named by ​​GL_DRAW_BUFFERi​​.
  • ​GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER​​​ is returned if ​​GL_READ_BUFFER​​ is not ​​GL_NONE​​ and the value of ​​GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE​​ is ​​GL_NONE​​ for the color attachment point named by ​​GL_READ_BUFFER​​.
  • ​GL_FRAMEBUFFER_UNSUPPORTED​​ is returned if the combination of internal formats of the attached images violates an implementation-dependent set of restrictions.
  • ​GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE​​​ is returned if the value of ​​GL_RENDERBUFFER_SAMPLES​​ is not the same for all attached renderbuffers; if the value of ​​GL_TEXTURE_SAMPLES​​ is the not same for all attached textures; or, if the attached images are a mix of renderbuffers and textures, the value of ​​GL_RENDERBUFFER_SAMPLES​​ does not match the value of ​​GL_TEXTURE_SAMPLES​​.
  • ​GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE​​​ is also returned if the value of ​​GL_TEXTURE_FIXED_SAMPLE_LOCATIONS​​ is not the same for all attached textures; or, if the attached images are a mix of renderbuffers and textures, the value of ​​GL_TEXTURE_FIXED_SAMPLE_LOCATIONS​​ is not ​​GL_TRUE​​ for all attached textures.
  • ​GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS​​ is returned if any framebuffer attachment is layered, and any populated attachment is not layered, or if all populated color attachments are not from textures of the same target.

 

Additionally, if an error occurs, zero is returned.

Errors

​GL_INVALID_ENUM​​​ is generated if ​target​​ is not ​​GL_DRAW_FRAMEBUFFER​​​, ​​GL_READ_FRAMEBUFFER​​​ or ​​GL_FRAMEBUFFER​​.

​GL_INVALID_OPERATION​​​ is generated by ​​glCheckNamedFramebufferStatus​​​ if ​framebuffer

Version Support

 

OpenGL Version

Function / Feature Name

2.0

2.1

3.0

3.1

3.2

3.3

4.0

4.1

4.2

4.3

4.4

4.5

​glCheckFramebufferStatus​

-

-











​glCheckNamedFramebufferStatus​

-

-

-

-

-

-

-

-

-

-

-


See Also

​glGenFramebuffers​​​, ​​glDeleteFramebuffers​​​ ​​glBindFramebuffer​

Copyright

Copyright © 2010-2014 Khronos Group. This material may be distributed subject to the terms and conditions set forth in the Open Publication License, v 1.0, 8 June 1999. ​​http://opencontent.org/openpub/​​.

中文翻译:

 

检查帧缓冲区的使用操作类型是否已准备好。

FBO完整性的判别法则如下:

  • 与FBO挂接的二维数组对象的长度和宽度必须不能为0。
  • 如果一个二维数组对象被挂接到FBO的颜色缓冲区挂接点时,二维数组必须具有内部颜色格式(GL_RGBA, GL_DEPTH_COMPONENT, GL_LUMINANCE等)。
  • 如果一个二维数组对象被挂接到FBO的深度缓冲区挂接点时,二维数组必须具有内部深度格式(GL_DEPTH_COMPONENT, GL_DEPTH_COMPONENT24_EXT等)。
  • 如果一个二维数组对象被挂接到FBO的模板缓冲区挂接点时,二维数组必须具有内部模板格式(GL_STENCIL_INDEX, GL_STENCIL_INDEX8_EXT等)。
  • FBO至少挂接有一个二维数组缓冲区对象。
  • 同一个FBO上挂接的二维数组对象必须拥有相同的长度和宽度。
  • 所有的颜色缓冲区挂接点上挂接的二维数组对象必须具有相同的内部格式。

GLenum glCheckFramebufferStatus(     GLenum target);

target

    Specify the target to which the framebuffer is bound for glCheckFramebufferStatus, and the target against which framebuffer completeness of framebuffer is checked for glCheckNamedFramebufferStatus.

指定帧缓冲区的使用操作类型。可以取GL_DRAW_FRAMEBUFFER, GL_READ_FRAMEBUFFER 和GL_FRAMEBUFFER.之一 GL_FRAMEBUFFER等价于GL_DRAW_FRAMEBUFFER.

 

返回值:

GL_FRAMEBUFFER_COMPLETE:帧缓冲区的使用操作类型准备好了

GL_FRAMEBUFFER_UNDEFINED:帧缓冲区是默认帧缓冲区,并且默认帧缓冲区不存在

GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT:帧缓冲区的所有挂载点都没有准备好

GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT:帧缓冲区一张图像也没有挂载