OpenGL“覆盖”两个渲染

时间:2010-02-15 11:11:04

标签: opengl gpu

博览会:

1) My viewport is 800x600
2) I have tex1 = frame buffer object; rendered to a texture, 800x600
3) I have tex2 = frame buffer object; rendered to a texture, 800x600

现在,我想在屏幕上创建以下图像:

tex1 _on top of_ tex2.

Where tex1 is black, display tex2's pixel.
Else, display tex1's pixel.

有没有办法可以完全在GPU上完成最后一步(看起来只是有点笨拙+显示到屏幕)。我目前的解决方案涉及1)阅读tex1& tex2返回CPU的内存2)在CPU上执行数组操作,3)将其发送回GPU,然后显示它。但是,似乎我应该能够完全在GPU上完成这项工作。

谢谢!

1 个答案:

答案 0 :(得分:1)

如果您使用的是最新版本的OpenGL,这对于fragment shader program来说听起来像是微不足道的工作。