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. Is it possible render stl files on QtGlWidget?
Forum Updated to NodeBB v4.3 + New Features

Is it possible render stl files on QtGlWidget?

Scheduled Pinned Locked Moved General and Desktop
openglqtglwidget
15 Posts 4 Posters 6.6k Views 2 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.
  • Lays147L Offline
    Lays147L Offline
    Lays147
    wrote on last edited by
    #1

    Well, is it? If yes, can you give me how to start? (Tutorials, websites, etc)
    Thanks!

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      Maybe with the use of the Qt3D module

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

      Lays147L 1 Reply Last reply
      0
      • A Offline
        A Offline
        alex_malyu
        wrote on last edited by
        #3

        You may consider high level 3D visualization libraries.
        They take some time to learn, but usually have higher level of abstraction than OpenGl/DirectX, etc.

        Free to use : VTK, Coin3D
        http://www.vtk.org/download/

        VTK has Qt binding, as far as I can recall Coin3D has it too.

        Lays147L 1 Reply Last reply
        0
        • N Offline
          N Offline
          NetZwerg
          wrote on last edited by
          #4

          We are using OpenCascade for this. There are already Qt examples (IESample) included for having a quick solution. OCC itself is pretty powerful but can be also very complex in further development. It is also not a slim package but a full CA* framework which results in a lot of additional libraries.

          1 Reply Last reply
          0
          • SGaistS SGaist

            Hi,

            Maybe with the use of the Qt3D module

            Lays147L Offline
            Lays147L Offline
            Lays147
            wrote on last edited by
            #5

            @SGaist The command:git clone --recursive https://code.qt.io/qt-creator/qt-creator.git from this tutorial: http://wiki.qt.io/Building_Qt_Creator_from_Git is not found.
            Where i get the qt3D?
            Thanks

            1 Reply Last reply
            0
            • SGaistS Offline
              SGaistS Offline
              SGaist
              Lifetime Qt Champion
              wrote on last edited by SGaist
              #6

              The clone URL is correct and working.

              You can find Qt3D at the same place: https://code.qt.io/qt/qt3d.git

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

              1 Reply Last reply
              0
              • Lays147L Offline
                Lays147L Offline
                Lays147
                wrote on last edited by Lays147
                #7
                This post is deleted!
                1 Reply Last reply
                0
                • Lays147L Offline
                  Lays147L Offline
                  Lays147
                  wrote on last edited by
                  #8

                  @SGaist
                  Please, help me. rs
                  I downloaded the qt3d for git, and try to add to my qt5 lib. but after qmake, when i run make this error appears:
                  In file included from ../../include/Qt3DCore/5.5.0/Qt3DCore/private/qabstractaspect_p.h:1:0,
                  from /home/lays/qt3d/src/core/aspects/qabstractaspect.cpp:40:
                  ../../include/Qt3DCore/5.5.0/Qt3DCore/private/../../../../../../../../qt3d/src/core/aspects/qabstractaspect_p.h:40:31: fatal error: private/qobject_p.h: No such file or directory
                  #include <private/qobject_p.h>
                  ^
                  compilation terminated.
                  make[2]: *** [.obj/qabstractaspect.o] Error 1
                  make[2]: Leaving directory /home/lays/QtEverywhere/qtbase/bin/src/core' make[1]: *** [sub-core-make_first] Error 2 make[1]: Leaving directory /home/lays/QtEverywhere/qtbase/bin/src'
                  make: *** [sub-src-make_first] Error 2
                  lays@lays:~/QtEverywhere/qtbase/bin$

                  Ps: My qt is build static and is the opensource license. (ubuntu 14)
                  How do i fix it?
                  Thanks!

                  1 Reply Last reply
                  0
                  • SGaistS Offline
                    SGaistS Offline
                    SGaist
                    Lifetime Qt Champion
                    wrote on last edited by
                    #9

                    Which version of Qt 5 do you have installed ?
                    Qt3D needs at least Qt 5.5, if you use the Qt 5.5RC package, Qt3D is included as tech preview.

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

                    1 Reply Last reply
                    0
                    • A alex_malyu

                      You may consider high level 3D visualization libraries.
                      They take some time to learn, but usually have higher level of abstraction than OpenGl/DirectX, etc.

                      Free to use : VTK, Coin3D
                      http://www.vtk.org/download/

                      VTK has Qt binding, as far as I can recall Coin3D has it too.

                      Lays147L Offline
                      Lays147L Offline
                      Lays147
                      wrote on last edited by
                      #10

                      @alex_malyu The binding of VTK with QT(5.4.2 or superior) is no supported. The Widget is only on qt version 5.0.1. On Qt Designer 4 i can load the widget, but i cant use in QtCreator.
                      i'm following this tutorial: http://www.vtk.org/Wiki/VTK/Tutorials/QtSetup

                      "NOTE: This does NOT work with versions of QtCreator built against Qt 5.0.1. At the time of this writing, the release with the package of Qt Libraries + Qt Creator is built against Qt 5.0.1, while the release of the stand alone QtCreator is built against Qt 4.8.3. The Designer plugin will simply not be loaded."

                      and @SGaist i'm downloading again qt5 for git, i will try to make again. thanks for the tip.

                      If anyone can give me any tip on how to read a stl file with qt, i really thanks.

                      My config about QtCreator:
                      Qt Creator 3.4.1 (opensource)
                      Based on Qt 5.4.2 (GCC 4.6.1, 64 bit)
                      Built on May 28 2015 18:39:12
                      From revision 29d81424a2

                      1 Reply Last reply
                      0
                      • A Offline
                        A Offline
                        alex_malyu
                        wrote on last edited by alex_malyu
                        #11

                        I am not using 5.4.2.+ so I might be wrong, but
                        as far as I understand all these talks are about PLUGIN.

                        And purpose of the plugin is to display QVTKWidget in the designer.
                        This does not work well anyway unless you build everything yourself, cause to work require Qt and Creator to be built with the same chain which at least for Windows would be a rare case.

                        If you need to place QVtkWidget (or any other widget) in the designer simply place QWidget and then promote it.
                        You will have to set specific for such widget properties in the code, but I believe it is the best practice anyway.

                        Lays147L 1 Reply Last reply
                        0
                        • A alex_malyu

                          I am not using 5.4.2.+ so I might be wrong, but
                          as far as I understand all these talks are about PLUGIN.

                          And purpose of the plugin is to display QVTKWidget in the designer.
                          This does not work well anyway unless you build everything yourself, cause to work require Qt and Creator to be built with the same chain which at least for Windows would be a rare case.

                          If you need to place QVtkWidget (or any other widget) in the designer simply place QWidget and then promote it.
                          You will have to set specific for such widget properties in the code, but I believe it is the best practice anyway.

                          Lays147L Offline
                          Lays147L Offline
                          Lays147
                          wrote on last edited by Lays147
                          #12

                          @alex_malyu
                          I found out that. Not necessarily need the widget. But I'm having trouble compiling. I picked up the function to read the STL's wiki VTK and edited to work on my program, but the compilation does not end. Are the following errors:

                          'brprint3d.o: In function readstl(QString)': ../Pandora/brprint3d.cpp:(.text+0x4927): undefined reference to vtkSTLReader::New()'
                          ../Pandora/brprint3d.cpp:(.text+0x4939): undefined reference to vtkSmartPointerBase::vtkSmartPointerBase(vtkObjectBase*, vtkSmartPointerBase::NoReference const&)' ../Pandora/brprint3d.cpp:(.text+0x4965): undefined reference to vtkPolyDataMapper::New()'
                          ../Pandora/brprint3d.cpp:(.text+0x4977): undefined reference to vtkSmartPointerBase::vtkSmartPointerBase(vtkObjectBase*, vtkSmartPointerBase::NoReference const&)' ../Pandora/brprint3d.cpp:(.text+0x4992): undefined reference to vtkAlgorithm::GetOutputPort(int)'
                          ../Pandora/brprint3d.cpp:(.text+0x49a0): undefined reference to vtkActor::New()' ../Pandora/brprint3d.cpp:(.text+0x49b2): undefined reference to vtkSmartPointerBase::vtkSmartPointerBase(vtkObjectBase*, vtkSmartPointerBase::NoReference const&)'
                          ../Pandora/brprint3d.cpp:(.text+0x49cd): undefined reference to vtkRenderer::New()' ../Pandora/brprint3d.cpp:(.text+0x49df): undefined reference to vtkSmartPointerBase::vtkSmartPointerBase(vtkObjectBase*, vtkSmartPointerBase::NoReference const&)'
                          ../Pandora/brprint3d.cpp:(.text+0x49e4): undefined reference to vtkRenderWindow::New()' ../Pandora/brprint3d.cpp:(.text+0x49f6): undefined reference to vtkSmartPointerBase::vtkSmartPointerBase(vtkObjectBase*, vtkSmartPointerBase::NoReference const&)'
                          ../Pandora/brprint3d.cpp:(.text+0x4a11): undefined reference to vtkRenderWindowInteractor::New()' ../Pandora/brprint3d.cpp:(.text+0x4a26): undefined reference to vtkSmartPointerBase::vtkSmartPointerBase(vtkObjectBase*, vtkSmartPointerBase::NoReference const&)'
                          ../Pandora/brprint3d.cpp:(.text+0x4a35): undefined reference to vtkRenderWindowInteractor::SetRenderWindow(vtkRenderWindow*)' ../Pandora/brprint3d.cpp:(.text+0x4a44): undefined reference to vtkRenderer::AddActor(vtkProp*)'
                          ../Pandora/brprint3d.cpp:(.text+0x4a94): undefined reference to vtkSmartPointerBase::~vtkSmartPointerBase()' ../Pandora/brprint3d.cpp:(.text+0x4a9e): undefined reference to vtkSmartPointerBase::~vtkSmartPointerBase()'
                          ../Pandora/brprint3d.cpp:(.text+0x4aa8): undefined reference to vtkSmartPointerBase::~vtkSmartPointerBase()' ../Pandora/brprint3d.cpp:(.text+0x4ab2): undefined reference to vtkSmartPointerBase::~vtkSmartPointerBase()'
                          ../Pandora/brprint3d.cpp:(.text+0x4abc): undefined reference to vtkSmartPointerBase::~vtkSmartPointerBase()' brprint3d.o:../Pandora/brprint3d.cpp:(.text+0x4ac6): more undefined references to vtkSmartPointerBase::~vtkSmartPointerBase()' follow
                          moc_brprint3d.o: In function BrPrint3D::qt_static_metacall(QObject*, QMetaObject::Call, int, void**)': moc_brprint3d.cpp:(.text+0x269): undefined reference to BrPrint3D::readstl(QString)'
                          clang: error: linker command failed with exit code 1 (use -v to see invocation)
                          make: *** [Pandora] Error 1'

                          I dont know what to do. =S

                          1 Reply Last reply
                          0
                          • A Offline
                            A Offline
                            alex_malyu
                            wrote on last edited by
                            #13

                            I assume you are using VTK 6.
                            It was redesigned and currently has a lot of modules which you have to link to if you use features from them.
                            Due to number of modules it is not an easy task.

                            For example vtkRenderer implementation is in vtkRenderingCore-6.1.lib ( -6.1.lib is compiler and system specific )

                            When I needed to find what I need to link against I built one of the example having features I was looking for with CMake,
                            then opened a project it created and looked which modules it was linked against,

                            For example my vtk application is linked to:

                            "vtkCommonCore-6.1.lib" "vtksys-6.1.lib" "vtkGUISupportQt-6.1.lib" "vtkCommonExecutionModel-6.1.lib" "vtkCommonDataModel-6.1.lib" "vtkCommonMath-6.1.lib" "vtkCommonMisc-6.1.lib" "vtkCommonSystem-6.1.lib" "vtkCommonTransforms-6.1.lib" "vtkFiltersExtraction-6.1.lib" "vtkFiltersCore-6.1.lib" "vtkFiltersGeneral-6.1.lib" "vtkCommonComputationalGeometry-6.1.lib" "vtkFiltersStatistics-6.1.lib" "vtkImagingFourier-6.1.lib" "vtkImagingCore-6.1.lib" "vtkalglib-6.1.lib" "vtkInteractionStyle-6.1.lib" "vtkFiltersSources-6.1.lib" "vtkRenderingCore-6.1.lib" "vtkFiltersGeometry-6.1.lib" "vtkRenderingOpenGL-6.1.lib" "vtkImagingHybrid-6.1.lib" "vtkIOImage-6.1.lib" "vtkDICOMParser-6.1.lib" "vtkIOCore-6.1.lib" "vtkzlib-6.1.lib" "vtkmetaio-6.1.lib" "vtkjpeg-6.1.lib" "vtkpng-6.1.lib" "vtktiff-6.1.lib" "vtkGUISupportQtOpenGL-6.1.lib" "vtkIOInfovis-6.1.lib" "vtkIOLegacy-6.1.lib" "vtkInfovisCore-6.1.lib" "vtklibxml2-6.1.lib" "vtkRenderingFreeTypeOpenGL-6.1.lib" "vtkRenderingFreeType-6.1.lib" "vtkfreetype-6.1.lib" "vtkftgl-6.1.lib" "vtkViewsInfovis-6.1.lib" "vtkChartsCore-6.1.lib" "vtkCommonColor-6.1.lib" "vtkRenderingContext2D-6.1.lib" "vtkFiltersImaging-6.1.lib" "vtkImagingGeneral-6.1.lib" "vtkImagingSources-6.1.lib" "vtkFiltersModeling-6.1.lib" "vtkInfovisLayout-6.1.lib" "vtkRenderingLabel-6.1.lib" "vtkViewsCore-6.1.lib" "vtkInteractionWidgets-6.1.lib" "vtkFiltersHybrid-6.1.lib" "vtkRenderingAnnotation-6.1.lib" "vtkImagingColor-6.1.lib" "vtkRenderingVolume-6.1.lib"

                            1 Reply Last reply
                            0
                            • Lays147L Offline
                              Lays147L Offline
                              Lays147
                              wrote on last edited by
                              #14

                              @alex_malyu I'm Deploying on Ubuntu, and i'm trying to use VTK 6.
                              Well, I think I will make it clear what I need to do. I do not know if you ever heard of Repetier Host(http://www.repetier.com/), it is a framework for 3D printing. I'm doing one like it, but I'm stuck on the issue of simulation of the files on the screen. I need to render a cube (print area) and inside loading the STL file that the user chooses. Why I am suffering for days looking for something that works. My project is connected to a static Qt because when I was trying to build with shared libraries was giving me a lot of headache and nothing I did worked. When you suggested VTK seemed a great solution, but I try, I search and nothing works. For now I do not mind the VTK work with shared libraries, as long as work.

                              1 Reply Last reply
                              0
                              • A Offline
                                A Offline
                                alex_malyu
                                wrote on last edited by
                                #15

                                You can build Qt and /or VTK statically or dynamically.
                                On Linux you will not be facing some problems if you mix statically/dynamically build components you might be facing on Windows.
                                But your application needs to be linked against all required modules.

                                Look at your VTK bin folder . It should have module named vtkRenderingCore (.a?).
                                Link against it, some problems you listed should be gone.
                                Then take next undefined reference.
                                find which module it belongs to, link to it and so on.

                                VTK people recommend to use CMAKE for your project.
                                In these case it is easier to resolve dependencies.

                                1 Reply Last reply
                                0

                                • Login

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