Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. How to show 3D model(.obj) in a QOpenGLWidget
Forum Updated to NodeBB v4.3 + New Features

How to show 3D model(.obj) in a QOpenGLWidget

Scheduled Pinned Locked Moved Unsolved General and Desktop
6 Posts 2 Posters 3.4k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    cdeveloper
    wrote on 27 Mar 2018, 14:58 last edited by
    #1

    I want to show a 3D model(*.obj) in a subclass of QOpenGLWidget,and how to do ?

    This is Widget3D.h file:
    0_1522162630427_QQ截图20180327225632.png

    This is Widget3D.cpp file:
    0_1522162638252_QQ截图20180327225646.png

    And i want to show toyplane.obj 3D model in my app, how to do ???

    1 Reply Last reply
    1
    • S Offline
      S Offline
      SGaist
      Lifetime Qt Champion
      wrote on 27 Mar 2018, 19:24 last edited by
      #2

      Hi and welcome to devnet,

      What about using Qt3D ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      C 1 Reply Last reply 28 Mar 2018, 01:13
      0
      • C Offline
        C Offline
        cdeveloper
        wrote on 28 Mar 2018, 00:54 last edited by
        #3
        This post is deleted!
        1 Reply Last reply
        0
        • S SGaist
          27 Mar 2018, 19:24

          Hi and welcome to devnet,

          What about using Qt3D ?

          C Offline
          C Offline
          cdeveloper
          wrote on 28 Mar 2018, 01:13 last edited by
          #4

          @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

          1. 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();
          
          1. 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?

          1 Reply Last reply
          0
          • S Offline
            S Offline
            SGaist
            Lifetime Qt Champion
            wrote on 28 Mar 2018, 21:03 last edited by
            #5

            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.

            Interested in AI ? www.idiap.ch
            Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

            C 1 Reply Last reply 29 Mar 2018, 01:00
            0
            • S SGaist
              28 Mar 2018, 21:03

              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.

              C Offline
              C Offline
              cdeveloper
              wrote on 29 Mar 2018, 01:00 last edited by
              #6

              @SGaist ok,Thank you.

              1 Reply Last reply
              0

              1/6

              27 Mar 2018, 14:58

              • Login

              • Login or register to search.
              1 out of 6
              • First post
                1/6
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • Users
              • Groups
              • Search
              • Get Qt Extensions
              • Unsolved