Get the maximum number of colored framebuffer attachments?
There are two values ββthat can potentially limit the number of attachments you can use:
-
GL_MAX_COLOR_ATTACHMENTS
indicates how many color anchor points the FBO has. In other words, this corresponds to the maximum valuen
that you can use when specifying anchor points withGL_COLOR_ATTACHMENTn
. This will limit the number of color textures / renders to simultaneously attach to the FBO. You can get this limit with:GLint maxAttach = 0; glGetIntegerv(GL_MAX_COLOR_ATTACHMENTS, &maxAttach);
-
GL_MAX_DRAW_BUFFERS
indicates how many buffers you can use at the same time. This is the maximum number of buffers you can go toglDrawBuffers()
, as well as the maximum number of outputs allowed in fragment shaders. You can get this limit with:GLint maxDrawBuf = 0; glGetIntegerv(GL_MAX_DRAW_BUFFERS, &maxDrawBuf);
These two values ββdo not need to be the same. Thus, it is possible that you can have a certain amount of attachments, but you cannot attract all of them at the same time.
The minimum value for both of these limits is 8 in OpenGL 3.x and up, up to the current 4.5 spec.
source to share