I am writing my application with OpenGL using GTK_GL_AREA widget from gtk-3. Everything worked well until I needed to use a framebuffer. First at all binding the default framebuffer with
glBindFramebuffer(GL_FRAMEBUFFER, 0);
doesn't result in render to anything. So I tested the default framebuffer id, without generating any other framebuffers.
glGetIntegerv(GL_FRAMEBUFFER_BINDING, &fob);
the result id was 1. And binding to a 1 resulted in a successful render onto the screen. Quite interestingly after generating a framebuffer the default framebuffer id became 2, generating another framebuffer 3 etc. Whereas the ids of generated framebuffer where 1,2,... etc. The code I used for generating a framebuffer is
glGenFramebuffers(1, &buffer);
glBindFramebuffer(GL_FRAMEBUFFER, buffer);
glGenTextures(1, &texture);
glBindTexture(GL_TEXTURE_2D, texture);
glTexImage2D(texture, 0, GL_RGBA8, width, height, 0, GL_BGRA, GL_UNSIGNED_BYTE, nullptr);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, texture, 0);
Rendering into any generated framebuffer seem not to produce any results. Even glClearColor leaves the attached texture black.
GtkGLAreausing a custom FBO internally is the documented behavior.glClearColoris not supposed to color anything. So without a MCVE, it is impossible to guess what your issue actually is. - derhass