Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/qt/7.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Qt 如何在QOpenGL中从一个FBO到另一个FBO绘制纹理?_Qt_Opengl_Qopenglfunctions - Fatal编程技术网

Qt 如何在QOpenGL中从一个FBO到另一个FBO绘制纹理?

Qt 如何在QOpenGL中从一个FBO到另一个FBO绘制纹理?,qt,opengl,qopenglfunctions,Qt,Opengl,Qopenglfunctions,我正在尝试使用QOpenGL进行一些屏幕外渲染工作,现在我想在第一个FBO中绘制pic,然后在另一个FBO中使用GLSL进行模糊处理,所以我需要做的第一件事是将第一个FBO中绘制的内容制作为纹理,然后将纹理绘制到另一个FBO,现在的过程如下: mFBO1->bind(); //Draw my data here mFBO1->release(); QImage qImg = mFBO1->toImage(); mFBO2->bind(); QOpenGLTexture

我正在尝试使用QOpenGL进行一些屏幕外渲染工作,现在我想在第一个FBO中绘制pic,然后在另一个FBO中使用GLSL进行模糊处理,所以我需要做的第一件事是将第一个FBO中绘制的内容制作为纹理,然后将纹理绘制到另一个FBO,现在的过程如下:

mFBO1->bind();
//Draw my data here
mFBO1->release();

QImage qImg = mFBO1->toImage();

mFBO2->bind();
QOpenGLTexture texture(&qImg);
texture->bind();
//Draw qimg as a texuture
texture->release();
mFBO2->release();
我的问题是:在代码中,我必须先使用toImage()获取纹理,然后将其作为QOpenGLTexture发送给GLSL,将第一个FBO中的数据作为纹理传输到另一个FBO会更容易吗?(我注意到QOPENGLFRAMEBUSERObject提供了一个方法takeTexture(),但我找不到使用它的示例)