Reputation: 51
I use qt 5.5 in ubuntu 18.04, i need to display 3d model(in obj format), i use qquickwidget and qml(Scene3D), it works fine for display model, but when the application exit, it will crash. the error message i get from qtcreator console as bellow:
QMutex::lock() 0x7ffff53b0725
QSemaphore::acquire(int) 0x7ffff53b23f4
Qt3D::QAspectManager::quit() 0x7fffc77c03bd
Qt3D::QAspectEngine::shutdown() 0x7fffc77be54a
Qt3D::QAspectEngine::~QAspectEngine() 0x7fffc77be94e
Qt3D::QAspectEngine::~QAspectEngine() 0x7fffc77be9d9
?? 0x7fffc8036c27
QMetaObject::activate(QObject *, int, int, void * *) 0x7ffff55d3cfa
QObject::destroyed(QObject *) 0x7ffff55d4a6f
QObject::~QObject() 0x7ffff55dcdab
QQuickWindow::~QQuickWindow() 0x7ffff3d43931
QQuickWindow::~QQuickWindow() 0x7ffff3d43999
?? 0x7ffff76bbb8a
?? 0x7ffff76bbc99
QObject::~QObject() 0x7ffff55dcb6b
QWidget::~QWidget() 0x7ffff6fc600b
QQuickWidget::~QQuickWidget() 0x7ffff76bb119
QObjectPrivate::deleteChildren() 0x7ffff55d2bdc
QWidget::~QWidget() 0x7ffff6fc5f8b
It seem like that it's because QQuickWindow destructor was called twice. I had try to remove the 3d related core in the qml, just draw a simple 2d rectangle, it will not be crashed, does anyone help me to fix this problem, thank you very much. Bellow are my qml file; (1) main.qml
import QtQuick 2.0
import QtQuick.Scene3D 2.0
import QtQuick.Controls 1.4
import QtQuick.Layouts 1.2
import Qt3D 2.0
Item {
id: main
Camera {
id: camera
}
Entity {
components: [
ShadowMapFrameGraph {
id: framegraph
viewCamera: camera
lightCamera: light.lightCamera
}
]
}
Light {
id: light
}
AdsEffect {
id: shadowMapEffect
shadowTexture: framegraph.shadowTexture
light: light
}
Scene3D {
id: scene3D
anchors.fill: parent
anchors.verticalCenter: parent.verticalCenter
focus: true
aspects: "input"
obj_model{
id: model
}
}
}
(2) obj_model.qml
import Qt3D 2.0
import Qt3D.Renderer 2.0
import QtQuick 2.1 as QQ2
Entity {
id: root
property Material material
Camera {
id: camera
projectionType: CameraLens.PerspectiveProjection
fieldOfView: 40
aspectRatio: 4/3
nearPlane : 0.1
farPlane : 3000.0
position: Qt.vector3d( 0.0, -1000, 300.0 )
upVector: Qt.vector3d( 0.0, 0.0, 1.0 )
viewCenter: Qt.vector3d( 0.0, 0.0, 300.0 )
}
Configuration {
controlledCamera: camera
}
components: [
FrameGraph {
activeFrameGraph: ForwardRenderer {
camera: camera
clearColor: "white"
}
}
]
PhongMaterial {
id: material
ambient: Qt.rgba( 0.8, 0.8, 0.8, 1.0 )
diffuse: Qt.rgba( 0.1, 0.1, 0.1, 0.5 )
shininess: 50 //shining.value
}
Transform {
id: logoTransform
}
Mesh {
id: logoMesh
source: "../res/model.obj"
}
Entity {
id: logoEntity
components: [ logoMesh, material, logoTransform ]
}
}
Upvotes: 1
Views: 660