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. OpenGL demos in Qt 4.8 don't compile

OpenGL demos in Qt 4.8 don't compile

Scheduled Pinned Locked Moved General and Desktop
12 Posts 4 Posters 14.9k Views
  • 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.
  • S Offline
    S Offline
    sasmaster
    wrote on last edited by
    #1

    So I downloaded the latest SDK and tried to setup the Boxes OpenGL demo on Windows . The compile throws me an error that it can't find gluPerspective identifier and it is right because the project doesn't reference this lib which should be glew . So I connected glew and put the header glew.h into glextension.h .Running the compiler again throws me the following preprocessor warning :

    #warning qglfunctions.h is not compatible with GLEW, GLEW defines will be undefined
    #warning To use GLEW with Qt, do not include <QtOpenGL> or <QGLFunctions> after glew.h

    So how do I deal with it ? If I remove those headers I need to delete almost half of Qt OpengGL methods in this demo and replace with those of glew.I suppose the author of the demo did something else so that he didn't need to use glew ? Anyone can help with this issue ?

    Thanks .

    1 Reply Last reply
    0
    • T Offline
      T Offline
      TheDestroyer
      wrote on last edited by
      #2

      In your qmake file, add:

      @
      QT += opengl
      @

      Good luck.

      1 Reply Last reply
      0
      • S Offline
        S Offline
        sasmaster
        wrote on last edited by
        #3

        It is set by default

        1 Reply Last reply
        0
        • T Offline
          T Offline
          TheDestroyer
          wrote on last edited by
          #4

          You are not supposed to add any glew or glut libraries to your programs. Just include QtOpenGL in your source and it will implicitly include everything it requires. Have you tried compiling the example called grabber? please compile it without editing it and paste the compilation log here if it doesn't compile. I based my first openGL simulation on that example.

          1 Reply Last reply
          0
          • S Offline
            S Offline
            sasmaster
            wrote on last edited by
            #5

            Look , I have already this header included by default . For example scene.h has it bit it doesn't recognize gluPerspective....

            1 Reply Last reply
            0
            • T Offline
              T Offline
              TheDestroyer
              wrote on last edited by
              #6

              My friend, please compile that example and copy the log so that I can help you. I can't suggest why this happens without reading the compilation log of an example I know. If that example compiles with no problems, then it's another story.

              1 Reply Last reply
              0
              • T Offline
                T Offline
                TheDestroyer
                wrote on last edited by
                #7

                This is the example I'm talking about

                http://doc.qt.nokia.com/4.7-snapshot/opengl-grabber.html

                Please find it in your SDK or download it to your computer. It should work properly, unless you have other problems that we could investigate later.

                1 Reply Last reply
                0
                • S Offline
                  S Offline
                  sasmaster
                  wrote on last edited by
                  #8

                  TheDestroyer , I have good and bad news for you .The good ones are that the grabber works .The bad news are that it has nothing to do with my issue.It doesn't contain gluPerpective() and it uses a fixed (old) pipeline .So it is seems unrelated.What I can see here is I can't even get any glu method in the editor IntelliSence completion . But have you tried to compile and run the Boxes demo by yourself ?
                  Output of the boxes compilation:
                  @
                  ..\boxes\scene.cpp(925) : error C3861: 'gluPerspective': identifier not found
                  Generating Code...
                  C:\QtSDK\QtCreator\bin\jom.exe -f Makefile.Debug
                  jom: C:\QtSDK\Demos\4.7\boxes-build-desktop-Qt_4_8_0_for_Desktop_-_MSVC2010__Qt_SDK__Debug\Makefile.Debug [debug\roundedbox.obj] Error 2

                  jom 1.0.8 - empower your cores

                  jom: C:\QtSDK\Demos\4.7\boxes-build-desktop-Qt_4_8_0_for_Desktop_-_MSVC2010__Qt_SDK__Debug\Makefile [debug] Error 2
                  13:27:19: The process "C:\QtSDK\QtCreator\bin\jom.exe" exited with code 2.
                  Error while building project boxes (target: Desktop)
                  When executing build step 'Make'
                  @

                  1 Reply Last reply
                  0
                  • S Offline
                    S Offline
                    sasmaster
                    wrote on last edited by
                    #9

                    Well ,I think the issue can be closed.The demo was missing

                    @
                    #include "gl/GLU.h"

                    @

                    inside QtOpenGL.h header.

                    Now it works .

                    1 Reply Last reply
                    0
                    • T Offline
                      T Offline
                      TheDestroyer
                      wrote on last edited by
                      #10

                      Good for you :-). Although I never needed to edit Qt sources, but if it works for you that way, have fun! ;-)

                      1 Reply Last reply
                      0
                      • M Offline
                        M Offline
                        mlong
                        wrote on last edited by
                        #11

                        If your problem's solved, be sure and edit the thread title to add [Solved]. Thanks.

                        Software Engineer
                        My views and opinions do not necessarily reflect those of anyone -- living or dead, real or fictional -- in this universe or any other similar multiverse node. Void where prohibited. Your mileage may vary. Caveat emptor.

                        1 Reply Last reply
                        0
                        • G Offline
                          G Offline
                          guillory
                          wrote on last edited by
                          #12

                          The demos included in SDK 1.2 seem to have a couple of issues when compiled with 4.8. In 4.8, OpenGL/glu.h is now intentionally no longer included within <QtOpenGL>, and programs that use it must include it themselves. For more info, see https://bugreports.qt-project.org/browse/QTSDK-1022

                          Adding #include "OpenGL/glu.h" after the other includes in qtbox.h in the boxes source tree fixes the problem without having to modify the main Qt headers.

                          Also, if you try to compile the demos.pro project, you will need to comment out the "#include <private/qpixmapdata_p.h>" line of the arthurwidgets.cpp file in the shared folder of the demos.

                          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