片段着色器渲染到屏幕外的帧缓冲区 [英] Fragment shader rendering to off-screen frame buffer

查看:119
本文介绍了片段着色器渲染到屏幕外的帧缓冲区的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在基于Qt的应用程序中,我想对两个纹理(均为1000x1000像素)执行片段着色器.

In a Qt based application I want to execute a fragment shader on two textures (both 1000x1000 pixels).

我绘制了一个矩形,片段着色器工作正常.

I draw a rectangle and the fragment shader works fine.

但是,现在我想将输出呈现到 GL_AUX0 帧缓冲区中,以使结果回读并保存到文件.

But, now I want to renderer the output into GL_AUX0 frame buffer to let the result read back and save to a file.

很遗憾,如果窗口尺寸小于1000x1000像素,则输出不正确.只是窗口大小区域被渲染到帧缓冲区上.

Unfortunately if the window size is less than 1000x1000 pixels the output is not correct. Just the window size area is rendered onto the frame buffer.

如何为整个纹理执行帧缓冲区?

How can I execute the frame buffer for the whole texture?

推荐答案

建议进行屏幕外处理的方法是使用帧缓冲对象(FBO).这些缓冲区的作用类似于您已经知道的渲染缓冲区,但不受窗口分辨率或颜色深度的限制.您可以使用 GPGPU帧缓冲对象类隐藏低级OpenGL命令并立即使用FBO.如果您喜欢自己做,请查看扩展规范.

The recommended way to do off-screen processing is to use Framebuffer Objects (FBO). These buffers act similar the render buffers you already know, but are not constrained by the window resolution or color depths. You can use the GPGPU Framebuffer Object Class to hide low-level OpenGL commands and use the FBO right away. If you prefer doing this on your own, have a look at the extension specification.

这篇关于片段着色器渲染到屏幕外的帧缓冲区的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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