qt android安装后闪退,qt for android 使用qml加载osg模型闪退

只要.qml文件加入到qrc文件中(Qt for Android推荐使用qrc),在qml设置如source的路径时,非远程(http等)和非file:///开头的,都从qrc资源文件里面找。如果非从sdcard中加载,就用file:///开头。

osg整合到QtQuick确实有点复杂,要了解Quick渲染的实现机制,官方文件也说了支持在Quick加混合使用OpenGL,但有一些要注意的地方,一些官方原文抄录如下:

Integration with OpenGL

It is possible to integrate OpenGL calls directly into the QQuickWindow using the same OpenGL context as the Qt Quick Scene Graph. This is done by connecting to the QQuickWindow::beforeRendering() or QQuickWindow::afterRendering() signal.

Note: When using QQuickWindow::beforeRendering(), make sure to disable clearing before rendering with QQuickWindow::setClearBeforeRendering().

Warning: It is crucial that OpenGL operations and interaction with the scene graph happens exclusively on the rendering thread, primarily during the updatePaintNode() phase.

Warning: As signals related to rendering might be emitted from the rendering thread, connections should be made using Qt::DirectConnection.

因我之前没做过类似的东西,所以无法给你提供更详细的帮助,但我觉得官方文档这几点“注意”是很重要的。还有例子源代码中有这一句:

void frame() {

if (!compositeViewer.valid()) return;

// Qt bug!?

QOpenGLContext::currentContext()->functions()->glUseProgram(0); //这里是否必要??

compositeViewer->frame();

}

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值