将深度渲染缓冲区复制到深度缓冲区 [英] Copying depth render buffer to the depth buffer
本文介绍了将深度渲染缓冲区复制到深度缓冲区的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
目前我正在使用附加的深度渲染缓冲区来渲染一些FBO。
Currently I am rendering some stuff to a FBO with an attached depth render buffer.
但是,在渲染缓冲区完成后,深度信息很漂亮
However, after I am done with the render buffer, the depth information is pretty much lost.
如何将数据从渲染缓冲区复制到固定函数深度缓冲区?
How can I copy the data from the render buffer to the fixed function depth buffer?
推荐答案
您可以使用 glBlitFramebuffer ,启用 GL_DEPTH_BUFFER_BIT
标志。
You can use glBlitFramebuffer, enabling the GL_DEPTH_BUFFER_BIT
flag.
示例代码:
glBindFramebuffer(GL_READ_FRAMEBUFFER, fbo_id);
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0);
glBlitFramebuffer(offset_x, offset_y, offset_x + size_x, offset_y + size_y,
offset_x, offset_y, offset_x + size_x, offset_y + size_y,
GL_DEPTH_BUFFER_BIT,
GL_NEAREST);
这将只复制深度缓冲区。
This will copy only the depth buffer.
这篇关于将深度渲染缓冲区复制到深度缓冲区的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文