[英]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.