Unsolved How to show 3D model(.obj) in a QOpenGLWidget
-
I want to show a 3D model(*.obj) in a subclass of QOpenGLWidget,and how to do ?
This is Widget3D.h file:
This is Widget3D.cpp file:
And i want to show toyplane.obj 3D model in my app, how to do ???
-
Hi and welcome to devnet,
What about using Qt3D ?
-
This post is deleted! -
@SGaist Oh, sorry, I previously mistakenly believe that QOpenGLWidget belongs to Qt:3D module。
Now I have already seen 3 examples:
qt3d-basicshapes-cpp-example
qt3d-materials-cpp-example
qt3d-simple-cpp-example- Is like this to embedded 3D windows to app ?,Is this the only way?:
Qt3DExtras::Qt3DWindow view; // Scene Root Qt3DCore::QEntity *sceneRoot = new Qt3DCore::QEntity(); ... RenderableEntity *chest = new RenderableEntity(sceneRoot); chest->transform()->setScale(0.03f); // load obj file chest->mesh()->setSource(QUrl(QStringLiteral("qrc:/assets/chest/Chest.obj"))); ... view.setRootEntity(sceneRoot); view.show();
- And if i use Qt:3D ,how can i control a 3D model(*.obj) using a QTimer,because I need to use a timer to control the gesture of the 3D model in my project,including mouse event, key event and repaint, resize etc.
how to do control it using Qt:3D,is there a reference example?
-
You should start here. You can find there amongst other things the Input and Animation module that will likely contain what you are looking for.
-
@SGaist ok,Thank you.