How to load PLY file in QT,C++, QML
-
Hello everyone.
I am quite new to QT and thanks for your supports in advance.
I am working on a hobby Windows application using QT, QML, and C++. I have a .PLY file (Polygon File Format) that I would like to read and render it on the page. I have done days of researches on what is the easiest way to develop this and somehow lost the track of the best approach.
I would appreciate if anyone has any experience or idea on how to implement this? Can we do it only using QML? or do we need to leverage OpenGL on C++ side to render .PLY file?
Happy coding :)
-
@TheEhsanG said in How to load PLY file in QT,C++, QML:
I have done days of researches on what is the easiest way to develop this and somehow lost the track of the best approach.
Took me 5 seconds to find this topic:
And 1 more minute to find this note in the documentation of Qt 3D's
QMesh
:Loads mesh data from external files in a variety of formats. Qt3DRender::QMesh loads data into a single mesh.
In Qt3D 5.9, QMesh supports the following formats:
* Wavefront OBJ * Stanford Triangle Format PLY * STL (STereoLithography)
(https://doc.qt.io/qt-6/qt3drender-qmesh.html#details)
While writing this I noticed that Qt3D is marked deprecated... I'm not sure what and in which way everything is replaced and set up in the future, but for your "hobby" projects, I would say, that it's still safe to use...
Maybe it will be removed in Qt7 someday...If you are fine with QML, you can use Qt Quick 3D
(Note that it's GPL or commercial only)Edit:
Seems like it's not possible with QtQuick3D to directly render .ply file content, but there is a console tool to convert the output you get from Blender, 3DS Max or Maya into QML usable files and render it...
This also includes .ply files. -
Hi Thanks for your help.
@Pl45m4 said in How to load PLY file in QT,C++, QML:
Took me 5 seconds to find this topic:
https://forum.qt.io/topic/94131/how-to-load-ply-content-properly
So this is using QWidget to render UI. I am not sure if I can use it in QML project. Can I ?
@Pl45m4 said in How to load PLY file in QT,C++, QML:
And 1 more minute to find this note in the documentation of Qt 3D's QMesh:
I will try to see if I can use Mesh in QML to render PLY file.
@Pl45m4 said in How to load PLY file in QT,C++, QML:
Seems like it's not possible with QtQuick3D to directly render .ply file content, but there is a console tool to convert the output you get from Blender, 3DS Max or Maya into QML usable files and render it...
This also includes .ply files.The problem I have with this approach is that the name of the PLY file can change, therefore, the name of the generated QML from using balsam will change as well and not sure how to use it in my QML (Basically this hobby project is to create a 3D-visualizer for PLY files, so user can drag and drop any PLY file into the app). I would be happy if you have any thoughts on this.
Thanks :)