I'm having trouble with the msaa depth buffer resolving to a depth texture. I create my glTexImage2d for both my color texture and my depth texture and bind them to the "resolve" ( non-msaa ) framebuffer. Then I create and bind another framebuffer and create my multisampled renderbuffers ( both color and depth ). I know to get my color texture information from the multisampled renderbuffer I just blit with the write buffer being my color texture framebuffer and the read buffer being my msaa-framebuffer. My question is how do I blit my multisampled depth buffer to my depth texture.

有帮助吗?

解决方案

You would do this the same way you would do for the color buffer, only you would use GL_DEPTH_BUFFER_BIT and make sure you use GL_NEAREST for the filter mode. If you want linear filtering on a depth/stencil buffer, for whatever reason, you can actually do this in GLSL if you use a depth texture (of course this still remains invalid for MSAA textures) - but it is invalid to do this using glBlitFramebuffer (...).

You do not have to do any of the glReadBuffer (...) nonsense like you do when you want to select an individual color buffer, glBlitFramebuffer (...) will copy the depth buffer from the bound GL_READ_FRAMEBUFFER to the bound GL_DRAW_FRAMEBUFFER.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top