如果指定了 GL_COLOR_BUFFER_BIT 掩码,glBlitFramebuffer 是否会复制所有颜色附件? [英] Does glBlitFramebuffer copy all color attachments if GL_COLOR_BUFFER_BIT mask is specified?
问题描述
如果我将像素从一个 FBO 复制到另一个 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.
推荐答案
A framebuffer color blitting operation 将 仅从当前glReadBuffer
中读取GL_READ_FRAMEBUFFER
,它会只写入glDrawBuffers
为 GL_DRAW_FRAMEBUFFER
指定.所以这不是关于附件;这是关于两个帧缓冲区的读取和绘制缓冲区.
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屋!