Is there a way to render to both, a renderbuffer and to the display without have to call multiple times the draw function? I wanted someting like this:
glBindFramebuffer(GL_FRAMEBUFFER, fbo);
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE2D, tbo, 0);
glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT);
GLenum* attachments[2] = {GL_COLOR_ATTACHMENT0, ...} //with the second I want to render to screen which would have the same value like the first
glDrawBuffer(2, attachments);
glDrawElements(GL_TRIANGLES, 12*3, GL_UNSIGNED_INT, 0);
So I can use what I drawed in the same time as a texture for another rendercall. I could just write
glBindFramebuffer(GL_FRAMEBUFFER, 0);
glDrawElements(GL_TRIANGLES, 12*3, GL_UNSIGNED_INT, 0);
but this would require to draw the scene again, which would be slow. Another solution would be just to draw the framebuffer, but I thought there would be a smarter solution.
glBlitFramebufferto copy from one framebuffer to another. Of course the data have to be copied, but there is no need to render the scene again.