在OpenGL中使用多个颜色附件对多重采样的FBO进行划线 [英] Blitting multisampled FBO with multiple color attachments in OpenGL

查看:501
本文介绍了在OpenGL中使用多个颜色附件对多重采样的FBO进行划线的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在带有多个颜色附件的OpenGL程序中有一个帧缓冲区对象,并正在尝试将其升级为多采样FBO.

I have a frame buffer object in an OpenGL program with multiple colour attachments, and am trying to upgrade it to a multisampled FBO.

据我了解,多采样FBO仅能使用渲染缓冲区,特别是使用glRenderbufferStorageMultisampleEXT创建的缓冲区.如果要在纹理中将此东西渲染到该FBO,则需要创建第二个FBO,并为其附件添加纹理,然后使用glBlitFramebufferEXT将多次采样的FBO转换为常规FBO.

As I understand it, a multisampled FBO is only able to use render buffers, specifically ones created using glRenderbufferStorageMultisampleEXT. If I want something rendered to this FBO in a texture, I need to create a second FBO with textures for its attachments, then blit the multisampled FBO to the regular FBO using glBlitFramebufferEXT.

我所见过的非常非常稀疏的示例假定使用单个颜色附件.当我要涂抹多个颜色附件时该怎么办?

The very, very sparse examples I've seen assume a single colour attachment. What do I do when I want to blit multiple colour attachments?

推荐答案

来自EXT_framebuffer_blit

12)我们是否应该添加对多个ReadBuffers的支持,以便 一次调用BlitFramebuffer可以复制多个颜色缓冲区吗?

12) Should we add support for multiple ReadBuffers, so that multiple color buffers may be copied with a single call to BlitFramebuffer?

已解决:不,我们考虑了这一点,但是行为很尴尬 进行定义,并且功能用途有限.

Resolved: No, we considered this but the behavior is awkward to define and the functionality is of limited use.

arb_framebuffer_object 规范(取代EXT_版本)

From the arb_framebuffer_object specification (which superscedes the EXT_ version)

传输颜色缓冲区时,将从读取的值中获取值 读取帧缓冲区的缓冲区,并写入每个绘图缓冲区 绘制帧缓冲区,就像使用CopyPixels一样.

When the color buffer is transferred, values are taken from the read buffer of the read framebuffer and written to each of the draw buffers of the draw framebuffer, just as with CopyPixels.

所以...很明显,每blit仅从单个颜色缓冲区进行解析.

So... It's pretty clear that you resolve only from a single color buffer per blit.

要执行多个操作,您需要对每个缓冲区进行Blit操作,为要进行blit的每个缓冲区更改READ_BUFFER,然后选择绘制帧缓冲区的相应绘制缓冲区.

To do multiple ones, you need to do a Blit for each buffer, changing your READ_BUFFER for each buffer you want to blit, and select the corresponding draw buffer of the draw framebuffer.

这篇关于在OpenGL中使用多个颜色附件对多重采样的FBO进行划线的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆