如果指定了GL_COLOR_BUFFER_BIT蒙版,glBlitFramebuffer是否复制所有颜色附件? [英] Does glBlitFramebuffer copy all color attachments if GL_COLOR_BUFFER_BIT mask is specified?
问题描述
如果我将像素从一个FBO复制到另一个,并且每个像素都有多个(不一定是相同数量的)颜色附件,并且如果我的遮罩是GL_COLOR_BUFFER_BIT
,则哪个颜色附件(GL_COLOR_ATTACHMENT0
,GL_COLOR_ATTACHMENT1
,....,GL_COLOR_ATTACHMENTi
)复制吗?他们都是?如果是,如果这些FBO附加了不同数量的颜色缓冲区,该怎么办?
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?
假设有2个以这种方式绑定的FBO:
Assume that there are 2 FBOs that are bound in this way:
glBindFramebuffer(GL_READ_FRAMEBUFFER, fbo1);
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, fbo2);
请注意,fbo1
具有2个颜色附件,而fbo2
具有4个颜色附件.
Note that fbo1
has 2 color attachments and fbo2
has 4 color attachments.
那么在这种情况下glBlitFrameBuffer
blit颜色附件如何处理?
So how does the glBlitFrameBuffer
blit color attachments in this case?
我在OpenGL文档的任何地方都找不到.
I could not find this anywhere in the OpenGL documentation.
推荐答案
帧缓冲区颜色闪烁操作将 only 从当前glReadBuffer
中读取GL_READ_FRAMEBUFFER
,它将 only 写入为GL_DRAW_FRAMEBUFFER
指定的glDrawBuffers
.因此,它与附件无关.这是关于两个帧缓冲区的读取和绘制缓冲区.
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.
这篇关于如果指定了GL_COLOR_BUFFER_BIT蒙版,glBlitFramebuffer是否复制所有颜色附件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!