简体   繁体   English

将FBO混合到默认帧缓冲区

[英]Blend FBO onto default framebuffer

To clarify, when I say 'default framebuffer' I mean the one provided by the windowing system and what ends up on your monitor. 澄清的是,当我说'默认帧缓冲'时,我的意思是窗口系统提供的那个以及显示器上的内容。

To improve my rendering speeds for a CAD app, I've managed to separate out the 3D elements from the Qt-handled 2D ones, and they now each render into their own FBO. 为了提高我的CAD应用程序的渲染速度,我设法将Qt处理的2D元素中的3D元素分离出来,现在它们都渲染到自己的FBO中。 When the time comes to get them onto the screen, I blit the 3D FBO onto the default FB, and then I want to blend my 2D FBO on top of it. 当我们将它们放到屏幕上时,我将3D FBO blit到默认的FB上,然后我想将我的2D FBO混合在它上面。

I've gotten to the blitting part fine, but I can't see how to blend my 2D FBO onto it? 我已经完成了blitting部分,但我看不出如何将我的2D FBO混合到它上面? Both FBOs are identical in size and format, and they are both the same as the default FB. 两个FBO的大小和格式都相同,它们都与默认FB相同。

I'm sure it's a simple operation, but I can't find anything on the net - presumably I'm missing the right term for what I am trying to do. 我确信这是一个简单的操作,但我在网上找不到任何东西 - 大概我错过了正在尝试做的事情的正确用语。 Although I'm using Qt, I can use native OpenGL commands without issue. 虽然我正在使用Qt,但我可以毫无问题地使用原生OpenGL命令。

A blit operation is ultimately a pixel copy operation. blit操作最终是像素复制操作。 If you want to layer one image on top of another, you can't blit it. 如果你想将一个图像叠加在另一个图像之上,则不能将其加入blit。 You must instead render a full-screen quad as a texture and use the proper blending parameters for your blending operation. 您必须将全屏四边形渲染为纹理,并使用适当的混合参数进行混合操作。

You can use GL_EXT_framebuffer_blit to blit contents of the framebuffer object to the application framebuffer (or to any other). 您可以使用GL_EXT_framebuffer_blit将framebuffer对象的内容blit到应用程序帧缓冲区(或任何其他)。 Although, as the spec states, it is not possible to use blending: 虽然,如规范所述,但不可能使用混合:

The pixel copy bypasses the fragment pipeline. 像素副本绕过片段管道。 The only fragment operations which affect the blit are the pixel ownership test and the scissor test. 影响blit的唯一片段操作是像素所有权测试和剪刀测试。

So any blending means to use fragment shader as suggested. 因此,任何混合都意味着按照建议使用片段着色器。 One fullscreen pass with blending should be pretty cheap, I believe there is nothing to worry about. 混合的全屏通道应该相当便宜,我相信没有什么可担心的。

use shader to read back from frame buffer. 使用着色器从帧缓冲区读回。 this is OpenGL ES extension, not support by all hardware. 这是OpenGL ES扩展,不是所有硬件都支持。

https://www.khronos.org/registry/gles/extensions/EXT/EXT_shader_framebuffer_fetch.txt https://www.khronos.org/registry/gles/extensions/EXT/EXT_shader_framebuffer_fetch.txt

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 从OpenGL中的默认帧缓冲区中读取像素数据:FBO与PBO的性能 - Read pixel data from default framebuffer in OpenGL: Performance of FBO vs. PBO OpenGL/GLSL 4.5 - 在默认 FBO 中使用 MRT - OpenGL/GLSL 4.5 - using MRT in the default FBO 如何在单独的视口中使用帧缓冲区以及默认帧缓冲区? - how to use framebuffer in a separate viewport along with default framebuffer? 是否可以将默认帧缓冲区复制到 OpenGL 中的另一个帧缓冲区 object? - is it possible to copy the default framebuffer to another framebuffer object in OpenGL? 是否可以将纹理作为渲染目标附加到默认帧缓冲区? - Is it possible to attach textures as render target to the default framebuffer? 如何将 FBO 的文本附件绘制到默认帧缓冲区? - How can I draw the text attachment of an FBO to the default frame buffer? Vulkan 交换链对 window 系统默认帧缓冲区的作用 - What Vulkan swapchain does to the window system default framebuffer Intel UHD 630 上的默认帧缓冲区未进行伽马校正 - Default framebuffer not gamma-correcting on Intel UHD 630 延迟渲染:在默认帧缓冲区中使用Gbuffer中的深度缓冲区 - Deferred Rendering: Use depth buffer from Gbuffer in default framebuffer 在无窗口的GLX程序中读取OpenGL的默认帧缓冲区 - Reading OpenGL's default framebuffer in a windowless GLX program
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM