When trying to attach texture buffer with half floating point to frame buffer it caused GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT , How I can solve this?
GLuint texture;
glGenTextures(1, &texture);
glBindTexture(GL_TEXTURE_2D, texture);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA16F, width, height, 0, GL_RGBA, GL_HALF_FLOAT, NULL);
GLuint depthbf;
glGenRenderbuffers(1, &depthbf);
glBindRenderbuffer(GL_RENDERBUFFER, depthbf);
glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH_COMPONENT16, width, height);
GLuint framebf;
glGenFramebuffers(1, &framebf);
glBindFramebuffer(GL_FRAMEBUFFER, framebf);
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, texture, 0);
glCheckFramebufferStatus(GL_FRAMEBUFFER); // GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT
glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, depthbf);
glCheckFramebufferStatus(GL_FRAMEBUFFER);//GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT
I tested this sample on Mali T760 GPU (Galaxy S6).
when I change this line
with
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
there is no problem but I want to readPixels as floating Point.
glReadPixels(0, 0, width, height, GL_RGBA, GL_FLOAT, data);