自定义 OpenGL 项目处于活动状态的 QML 文本渲染问题 [英] QML text rendering issue with custom OpenGL item active

查看:55
本文介绍了自定义 OpenGL 项目处于活动状态的 QML 文本渲染问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在使用 QmlOgre Qt 示例使其与 Qt5 final 一起使用.原始示例本身现在看起来不错,并且按预期运行.我的代码在这里:https://github.com/advancingu/QmlOgre

I've been working with the QmlOgre Qt example to make it work with Qt5 final. The original example itself looks fine now and behaves as intended. My code is here: https://github.com/advancingu/QmlOgre

然而,我发现当 QML 文本项通过从 C++ 或示例 QML 场景中的简单计时器发出的已更改 信号进行修改时会出现问题.例如,我添加了一个 10 毫秒的 QML 计时器,它只是增加一个计数器并将其分配给一个文本项.对应的代码在这里:https://github.com/advancingu/QmlOgre/tree/issue

However I found that there is an issue when a QML text item is modified either through changed signals emitted from C++ or from a simple timer in the sample QML scene. For example, I added a 10ms QML timer that simply increments a counter and assigns it to a text item. The corresponding code is here: https://github.com/advancingu/QmlOgre/tree/issue

现在发生的情况是,在每一帧上,文本项的大多数字符(除了一两个)随机消失.哪一个消失随着每一帧的变化而变化,所以有很多闪烁.确实显示的字符是正确的字符并且位于正确的位置.

What happens now is that on each frame, most characters (except one or two) of the text item randomly disappear. Which of them disappear changes with each frame, so there is a lot of flickering. The characters that do show are the correct ones and at the correct location.

我的观察是这个问题只出现在一些应用程序执行上,所以它看起来很像一个线程问题(QmlEngine 运行一个处理 QML 对象绑定的线程,QML 绘画有自己的线程,Ogre 生活/必须生活在其中).

My observation has been that this issue only appears on some application executions, so it very much looks like a threading issue (QmlEngine runs one thread dealing with QML object bindings, QML painting has its own thread in which Ogre lives / must live).

有人知道为什么会发生这种情况或如何解决吗?

Anyone have ideas on why exactly this is happening or how this can be resolved?

  • 食人魔版本:1.8.1
  • Qt 版本:5.0.1(今天的 5.1-dev 也有同样的问题)
  • 操作系统/发行版:Ubuntu 12.04 64 位
  • 图形驱动程序:尝试使用 Mesa 9.0 和 FGLRX(均显示)

推荐答案

仍然不确定是什么导致了这个问题,但我找到了一种方法来解决它,方法是在 OgreNode 中创建一个单独的 OpenGL 上下文来使用通过食人魔.当然,这可能会导致性能恶化,但这仍然比不可靠的工作要好.我的代码库中的代码已通过修复更新.

Still not sure what caused the issue but I found a way to fix it by creating a separate OpenGL context in OgreNode to be used by Ogre. Of course this could cause performance to worsen, however this is still better than things not working reliably. Code in my repository is updated with the fix.

这篇关于自定义 OpenGL 项目处于活动状态的 QML 文本渲染问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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