我目前正在 QML 中集成自定义 OpenGL 视口QQuickFramebuffer对象。我观察到整个应用程序窗口(不仅是QQuickFramebuffer对象窗口),我想知道为什么。
我的定制QQuickFramebufferObject::渲染器确实创建了一个单独的 FPO:
QOpenGLFramebufferObject* OsgRenderer::createFramebufferObject(const QSize &size)
{
QOpenGLFramebufferObjectFormat format;
format.setAttachment(QOpenGLFramebufferObject::CombinedDepthStencil);
return new QOpenGLFramebufferObject(size, format);
}
所以我明白Qt定义了自己的FBO类型(QOpenGL帧缓冲对象)这样它以后就可以使用 FBO 将其与自己的 GL 渲染混合,对吗?
然后我完成所有渲染
void OsgRenderer::render()
{
assert(m_osgItem);
if ( !m_osgItem->getViewer() )
return;
// Without this line the model is not displayed in the second
// and subsequent frames.
QOpenGLContext::currentContext()->functions()->glUseProgram(0);
// Ask OSG to render.
m_osgItem->getViewer()->frame(); // WARNING: non-blocking (executed in a thread of its own - in a thread-safe way).
// Reset OpenGl state for QtQuick.
m_osgItem->window()->resetOpenGLState();
}
我希望 QtQuick 在调用 render() 之后实际收集我的自定义渲染 FBO 及其自己的窗口渲染,对吗?
我的渲染实际上是在单独的上下文中实现的。在这种情况下,怎么会导致闪烁呢?任何想法?
None
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)