1

I am trying to implement MSAA together with HDR and Bloom. I want to blit a buffer object with two color attachments to another frame buffer with two color attachments also. I tried the following with no success

glBindFramebuffer(GL_READ_FRAMEBUFFER, msaaFrameBuffer);
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, hdrFBO);
glReadBuffer(GL_COLOR_ATTACHMENT0);
glDrawBuffer(GL_COLOR_ATTACHMENT0);
glBlitFramebuffer(0, 0, renderWidth, renderHeight, 0, 0, renderWidth, renderHeight, GL_COLOR_BUFFER_BIT, GL_NEAREST);
glBindFramebuffer(GL_READ_FRAMEBUFFER, msaaFrameBuffer);
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, hdrFBO);
glReadBuffer(GL_COLOR_ATTACHMENT1);
glDrawBuffer(GL_COLOR_ATTACHMENT1);
glBlitFramebuffer(0, 0, renderWidth, renderHeight, 0, 0, renderWidth, renderHeight, GL_COLOR_BUFFER_BIT, GL_NEAREST);

it just copies the first color attachment of the source frame buffer to both color attachments of the target frame buffer. What am I missing here?

Mike F
  • 316
  • 3
  • 14
  • Related [Does glBlitFramebuffer copy all color attachments if GL_COLOR_BUFFER_BIT mask is specified?](https://stackoverflow.com/questions/17691702/does-glblitframebuffer-copy-all-color-attachments-if-gl-color-buffer-bit-mask-is) – Rabbid76 Nov 15 '20 at 21:10
  • Do you get an OpenGL error? – Rabbid76 Nov 15 '20 at 21:20
  • How can I check for errors during runtime? (Sorry I am new to OpenGL) – Mike F Nov 16 '20 at 07:02
  • [`glGetError`](https://www.khronos.org/registry/OpenGL-Refpages/gl4/html/glGetError.xhtml) or [Debug Output](https://www.khronos.org/opengl/wiki/Debug_Output) – Rabbid76 Nov 16 '20 at 07:57
  • 1
    @Rabbid76 Thanks I will implement this during the day and update with the results here – Mike F Nov 16 '20 at 08:16
  • @Rabbid76 Hi, sorry for the delay since I am working on this on my spare time.. I get no errors. – Mike F Nov 16 '20 at 17:01
  • 1
    I found the problem. The code above works fine I just created the color attachments wrong in one of the framebuffers. When I fixed that I was able to blit fine. Thanks – Mike F Nov 16 '20 at 17:15

0 Answers0