Does glBlitFramebuffer copy all color attachments if GL_COLOR_BUFFER_BIT mask is specified?

浪尽此生 提交于 2019-12-10 01:31:33

问题


If I am copying pixels from one FBO to another and each of them have multiple (not necessary the same number) of color attachments, and if my mask is GL_COLOR_BUFFER_BIT, which color attachments (GL_COLOR_ATTACHMENT0, GL_COLOR_ATTACHMENT1, ...., GL_COLOR_ATTACHMENTi) does it copy? All of them? If yes, what if these FBOs have different number of color buffers attached to them?

Assume that there are 2 FBOs that are bound in this way:

glBindFramebuffer(GL_READ_FRAMEBUFFER, fbo1); 
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, fbo2); 

Note that fbo1 has 2 color attachments and fbo2 has 4 color attachments.

So how does the glBlitFrameBuffer blit color attachments in this case?

I could not find this anywhere in the OpenGL documentation.


回答1:


A framebuffer color blitting operation will only read from the current glReadBuffer for the GL_READ_FRAMEBUFFER, and it will only write to the glDrawBuffers specified for the GL_DRAW_FRAMEBUFFER. So it's not about the attachments; it's about the read and draw buffers of the two framebuffers.



来源:https://stackoverflow.com/questions/17691702/does-glblitframebuffer-copy-all-color-attachments-if-gl-color-buffer-bit-mask-is

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!