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. Struggling with QGLView examples
Forum Update on Tuesday, May 27th 2025

Struggling with QGLView examples

Scheduled Pinned Locked Moved General and Desktop
16 Posts 3 Posters 4.6k 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.
  • A Offline
    A Offline
    avmg
    wrote on last edited by
    #1

    Hi everybody,

    I'm want to load a model using OpenGL, so i decide to start with the teapot example, the problem is that i get this error that i can not solve:

    error: no matching function for call to 'QGLView::QGLView(QWidget*&)' TeapotView(QWidget *parent = 0) : QGLView(parent), teapot(0) {}

    I tried another examples and using the qglview library functions but i always get the same error. The only thing i could run was to draw a triangle writing the coordinates with the qlBegin() function.

    Do i need to install another library to use qglview?

    Thanks,
    Andres

    1 Reply Last reply
    0
    • JKSHJ Offline
      JKSHJ Offline
      JKSH
      Moderators
      wrote on last edited by
      #2

      Hi,

      QGLView is part of the Qt 3D module. However, that module has not yet been released. It is currently undergoing a major rewrite.

      However, if you are feeling adventurous, you could build the latest nightly version of Qt 3D yourself (pull it from the git repository). See http://comments.gmane.org/gmane.comp.lib.qt.devel/19832

      Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

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

        Ok, So what i need to do to execute just the teapot example? I tried with another examples of code and i get the same error...

        1 Reply Last reply
        0
        • JKSHJ Offline
          JKSHJ Offline
          JKSH
          Moderators
          wrote on last edited by
          #4

          You have two options:

          Wait for Qt 3D to be released, OR

          Compile the bleeding edge (unstable) version of Qt yourself

          After that, you can run the teapot example.

          Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

          1 Reply Last reply
          0
          • A Offline
            A Offline
            avmg
            wrote on last edited by
            #5

            And, Which alternatives do i have if i want to load a 3D model? With OpenGL i have these 2 options that you comment before, Does it exist any other easy way to do it? I found assimp also... What do you think?

            Thanks for the replies!
            Andres

            1 Reply Last reply
            0
            • JKSHJ Offline
              JKSHJ Offline
              JKSH
              Moderators
              wrote on last edited by
              #6

              You're welcome :)

              Qt 3D incorporates Assimp, so the same options apply.

              In addition, you can link your program directly to the Assimp library to load and display 3D models. See "Third Party Libraries":http://doc.qt.io/qt-5/third-party-libraries.html to find out how.

              Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

              1 Reply Last reply
              0
              • A Offline
                A Offline
                avmg
                wrote on last edited by
                #7

                Hi again,

                I tried what you told me before with an example linking directly to Assimp library, but I still have these errors:

                undefined reference to `QOpenGLWidget::QOpenGLWidget(QWidget*, QFlagsQt::WindowType)'

                ...and many others refered to QOpenGLWidget. I tried to find out and i saw to add opengl to QT in pro, but nothing happened...

                Any suggestion?

                1 Reply Last reply
                0
                • JKSHJ Offline
                  JKSHJ Offline
                  JKSH
                  Moderators
                  wrote on last edited by
                  #8

                  Can you post your full .pro file?

                  QOpenGLWidget is not in the "opengl" module. It is in the "gui" module. The "opengl" module is old and deprecated.

                  Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

                  1 Reply Last reply
                  0
                  • A Offline
                    A Offline
                    avmg
                    wrote on last edited by
                    #9

                    @
                    QT += core gui opengl xml
                    CONFIG += opengl
                    CONFIG += thread

                    greaterThan(QT_MAJOR_VERSION, 4): QT += widgets

                    TARGET = TexturedCubeWithLightingFromBlender
                    TEMPLATE = app

                    INCLUDEPATH += /home/amg/Qt/assimp-3.1.1/include
                    INCLUDEPATH += /home/amg/include/Qt3D
                    INCLUDEPATH += /home/amg/qt5/qtbase/src/widgets/kernel
                    INCLUDEPATH += /usr/include/qt5/QtOpenGL
                    LIBS += -L/home/amg/Qt/assimp-3.1.1/lib -lassimp
                    LIBS += -L/usr/lib/x86_64-linux-gnu -lGLU

                    SOURCES += main.cpp
                    Dialog.cpp
                    Scene.cpp
                    MeshLoader.cpp
                    Cube.cpp

                    HEADERS += Dialog.h
                    Scene.h
                    MeshLoader.h
                    Cube.h

                    FORMS += Dialog.ui

                    RESOURCES +=
                    Shaders.qrc
                    Textures.qrc

                    @

                    1 Reply Last reply
                    0
                    • E Offline
                      E Offline
                      euchkatzl
                      wrote on last edited by
                      #10

                      Are you using Qt 5.4 ? QOpenGlWidget is only part of qt 5.4.

                      I think using the old qt 3d module is the best choice for you because with linking directly to assimp you can only load your model but you have to implement displaying and user interaction on your own. In qt 3d this is already done via QGLView.
                      If you want to use Qt 3d you have to compile and install it on your own.

                      Thats very simple :

                      • Checkout the Qt 3d Source
                      • Open qt3d.pro and configure your settings (you can use shadow build)
                      • Compile
                      • After a successful compile you have to install that module to your qt installation
                        ** Open Terminal and cd into your shadow build dir
                        ** Type "make install" (or nmake install on windows)
                      • After that you could use qt 3d module in any of your applications by adding 3d to your qt modules ( QT += 3d )

                      For loading Models look at http://qt-project.org/wiki/Loading-a-3D-Model

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

                        Ok, I will follow your instructions. First of all today I saw that it's available the Qt5.4 version, Do you recomend to install it? Actually i'm using assimp to load models, but i have more examples to follow under qt3d than assimp, and also better documents.

                        And now i understand why i got errors like 'no reference to QGLView', or 'Qt += 3d' not recognized.

                        Thanks euchkatzl!

                        1 Reply Last reply
                        0
                        • E Offline
                          E Offline
                          euchkatzl
                          wrote on last edited by
                          #12

                          You can install it but you have to do the steps above for every new qt version you have installed.

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

                            Hi,

                            I tried to compile the qt3d.pro but i get a lot of errors... the first errors were about the includepaths, i modified and i get new errors like 'removeAll' function doesn't exists, or 'QAtomicInteger' does not name a type ... after i tried typing in a terminal:

                            qmake && make

                            ...but i get new errors. Is there any trick/tip/whatever to do it?

                            Thanks

                            1 Reply Last reply
                            0
                            • JKSHJ Offline
                              JKSHJ Offline
                              JKSH
                              Moderators
                              wrote on last edited by
                              #14

                              [quote author="avmg" date="1422377472"]
                              undefined reference to `QOpenGLWidget::QOpenGLWidget(QWidget*, QFlagsQt::WindowType)' [/quote]Try recompiling your Assimp project again with Qt 5.4 (the latest release).

                              [quote author="avmg" date="1422473852"]I tried to compile the qt3d.pro but i get a lot of errors[/quote]Like I said before, if you want to compile Qt 3D, then you must first compile the bleeding edge (unstable) version of Qt. See http://comments.gmane.org/gmane.comp.lib.qt.devel/19832 -- you need to check out the 'dev' branch of each Qt repository from git. Qt 5.4 is too old. (Yes, the latest release is too old to build Qt 3D)

                              [quote author="avmg" date="1422460483"]i'm using assimp to load models, but i have more examples to follow under qt3d than assimp, and also better documents.[/quote]The Qt 3D documents are old and might be invalid though :( Remember: The developers are currently rewriting Qt 3D.

                              Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

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

                                Hi again,

                                While the new Qt version is being developed, i decide to load the models using Assimp. Actually i'm able to load a 3Ds model and draw it in a glutWindow, but Is it possible to draw it in a QWidget?
                                I "painted" before some shapes using gl functions in a QWidget but not loaded models...

                                1 Reply Last reply
                                0
                                • JKSHJ Offline
                                  JKSHJ Offline
                                  JKSH
                                  Moderators
                                  wrote on last edited by
                                  #16

                                  [quote author="avmg" date="1422553516"]Actually i'm able to load a 3Ds model and draw it in a glutWindow, but Is it possible to draw it in a QWidget?
                                  I "painted" before some shapes using gl functions in a QWidget but not loaded models...[/quote]I don't know, actually.

                                  How did you paint the shapes in QWidgets?

                                  Try using "QOpenGLWidget":http://doc.qt.io/qt-5/qopenglwidget.html

                                  Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

                                  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