[Interest] why do I don't see my 3d mesh ?

jagernicolas at legtux.org jagernicolas at legtux.org
Tue Jun 26 23:10:14 CEST 2018


 

yep it works, 

thx a lot I was far away thinking the problem came from there... 

regards, 

Nicolas Jäger 

On 2018-06-26 04:05, Sebastian Rampe wrote: 

> are you using an actual materal like phongmaterieal 
> 
> https://doc.qt.io/qt-5.11/qml-qt3d-extras-phongmaterial.html [1] 
> 
> Material {
> id: material
> parameters: [
> Parameter { name: "color"; value: "green" }
> ]
> } 
> wont work in my setup 
> phongmaterieal { 
> diffuse: qt.color(0,255,0) 
> } 
> does the job 
> 
> Am Mo., 25. Juni 2018 um 16:32 Uhr schrieb <jagernicolas at legtux.org>: 
> 
> still stuck with this issue. 
> 
> On 2018-06-23 16:40, jagernicolas at legtux.org wrote: 
> 
> Hi, 
> 
> I failed to load a 3d object with the following code: 
> 
> **- main.cpp**
> 
> #include <QGuiApplication>
> #include <QQmlApplicationEngine>
> 
> int main(int argc, char *argv[])
> {
> QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
> 
> QGuiApplication app(argc, argv);
> 
> QQmlApplicationEngine engine;
> engine.load(QUrl(QStringLiteral("qrc:/main.qml")));
> if (engine.rootObjects().isEmpty())
> return -1;
> 
> return app.exec();
> }
> 
> **- main.qml**
> 
> import QtQuick.Window 2.2
> import QtQuick.Controls 2.2
> import QtQuick.Dialogs 1.2
> 
> import QtQuick.Scene3D 2.0
> 
> import Qt3D.Core 2.0
> import Qt3D.Render 2.0
> import Qt3D.Input 2.0
> import Qt3D.Extras 2.0
> 
> import QtQuick.Layouts 1.3
> 
> ApplicationWindow
> {
> visible: true
> width: 640
> height: 480
> title: qsTr("3D Viewer")
> 
> header: ToolBar
> {
> RowLayout
> {
> anchors.fill: parent
> ToolButton
> {
> id: exitBtn
> text: "Exit"
> onPressed:
> {
> Qt.quit()
> }
> }
> ToolButton
> {
> id: loadModelBtn
> text: "Load Model"
> onPressed:
> {
> fileDialog.open()
> }
> }
> }
> }
> 
> FileDialog
> {
> id: fileDialog
> onAccepted:
> {
> mesh.source = fileDialog.fileUrl
> }
> }
> 
> Scene3D
> {
> anchors.fill: parent
> 
> aspects: ["input", "logic"]
> cameraAspectRatioMode: Scene3D.AutomaticAspectRatio
> 
> Entity
> {
> id: sceneRoot
> 
> Camera
> {
> id: camera
> projectionType: CameraLens.PerspectiveProjection
> fieldOfView: 30
> aspectRatio: 16/9
> nearPlane : 0.1
> farPlane : 1000.0
> position: Qt.vector3d( 20.0, 0.0, 0.0 )
> upVector: Qt.vector3d( 0.0, 1.0, 0.0 )
> viewCenter: Qt.vector3d( 0.0, 0.0, 0.0 )
> }
> 
> OrbitCameraController
> {
> camera: camera
> }
> 
> components: [
> RenderSettings
> {
> activeFrameGraph: ForwardRenderer
> {
> clearColor: Qt.rgba(0, 0.5, 1, 1)
> camera: camera
> }
> },
> InputSettings
> {
> }
> ]
> 
> Entity {
> components: [
> Mesh {
> id: mesh
> },
> Material {
> id: material
> parameters: [
> Parameter { name: "color"; value: "green" }
> ]
> }
> ]
> }
> 
> }
> }
> }
> 
> I paste the whole code but hen I changed the word `Mesh` for `SceneLoader` I can load my obj file without problem. I guess there is something I miss in the case of the `mesh`. 
> 
> nb : I can upload the whole project if required. 
> 
> regards, 
> 
> // Nicolas Jäger 
> 
> _______________________________________________
> Interest mailing list
> Interest at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/interest [2] 
> 
> _______________________________________________
> Interest mailing list
> Interest at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/interest [2]

 

Links:
------
[1] https://doc.qt.io/qt-5.11/qml-qt3d-extras-phongmaterial.html
[2] http://lists.qt-project.org/mailman/listinfo/interest
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20180626/b4509a3d/attachment.html>


More information about the Interest mailing list