Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
907 views
in Technique[技术] by (71.8m points)

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

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.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...