Attaching color buffers of different sizes to FBO with Direct State Access in OpenGL 4.5 leads to GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT.
Steps to Reproduce:
// Create textures
GLuint tex[2];
glCreateTextures(GL_TEXTURE_2D, 2, tex);
glTextureStorage2D(tex[0], 1, GL_RGB8, 2048, 2048);
glTextureStorage2D(tex[1], 1, GL_RGB8, 1024, 1024);
// Create FBO
GLuint fbo;
glCreateFramebuffers(1, &fbo);
glNamedFramebufferTexture(fbo, GL_COLOR_ATTACHMENT0, tex[0], 0);
glNamedFramebufferTexture(fbo, GL_COLOR_ATTACHMENT1, tex[1], 0);
// Check completeness
GLenum comp = glCheckNamedFramebufferStatus(fbo, GL_FRAMEBUFFER);
I’d expect completeness to be GL_FRAMEBUFFER_COMPLETE, however, in my case glCheckNamedFramebufferStatus returns GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT.
But if I create FBO in the traditional way, it won’t give me this error:
Just replace
glCreateFramebuffers(1, &fbo);
with
glGenFramebuffers(1, &fbo);
glBindFramebuffer(GL_FRAMEBUFFER, fbo); // make it valid
In this case, completeness is GL_FRAMEBUFFER_COMPLETE. Even other functions are in the form of glNamed*.
My environment:
Graphics card: GeForce GTX 1660 Ti
Driver version: 512.15
Operating system: Windows 10 Enterprise 64-bit