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. [Solved] Qt always tries to use OpenGL ES2 under Win7 64-Bit
Forum Updated to NodeBB v4.3 + New Features

[Solved] Qt always tries to use OpenGL ES2 under Win7 64-Bit

Scheduled Pinned Locked Moved General and Desktop
12 Posts 4 Posters 15.7k 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
    andreas.hammerschmidtgmx.net
    wrote on last edited by
    #1

    Hi!

    I've got a new developer machine, moved over my development environment and recompiled Qt 4.7.3 using the following environment:

    • Windows 7 Professional 64-Bit
    • Visual Studio 2010 Professional SP1
    • Qt Add-In 1.1.9-1
    • Qt 4.7.3 Sources (from ZIP)
    • Visual Studio 2010 Command Prompt (with and without Admin rights)
    • QTDIR set to C:\Qt\4.7.3 and PATH contains %QTDIR%

    When I try to compile our solution 45 projects work fine, but one project using OpenGL fails with the following messages:
    @1>ClCompile:
    1> moc_SceneWidget.cpp
    1>c:\qt\4.7.3\include\qtopengl../../src/opengl/qgl.h(69): fatal error C1083: Datei (Include) kann nicht geöffnet werden: "GLES2/gl2.h": No such file or directory
    1> moc_SceneWindow.cpp
    1>c:\qt\4.7.3\include\qtopengl../../src/opengl/qgl.h(69): fatal error C1083: Datei (Include) kann nicht geöffnet werden: "GLES2/gl2.h": No such file or directory@

    So I tried to use "configure -opengl desktop" which leads to problems compiling Qt. I used the following batch file for configuration and compile:
    @set QMAKESPEC=win32-msvc2010
    configure.exe -platform %QMAKESPEC% -opensource -opengl desktop -mp -release -fast -plugin-sql-sqlite -no-webkit -no-phonon -no-phonon-backend -no-script -no-scripttools -no-qt3support
    nmake@
    But compile fails and shows a lot of errors complaining about EGL* constants and functions:
    @egl\qegl.cpp(471) : error C2065: 'EGL_NO_CONTEXT': nichtdeklarierter Bezeichner
    egl\qegl.cpp(475) : error C2065: 'EGL_NO_SURFACE': nichtdeklarierter Bezeichner
    egl\qegl.cpp(490) : error C2065: 'EGL_NO_SURFACE': nichtdeklarierter Bezeichner
    egl\qegl.cpp(490) : error C2065: 'EGL_NO_SURFACE': nichtdeklarierter Bezeichner
    egl\qegl.cpp(490) : error C2065: 'EGL_NO_CONTEXT': nichtdeklarierter Bezeichner
    egl\qegl.cpp(490) : error C3861: "eglMakeCurrent": Bezeichner wurde nicht gefunden@
    ("nichtdeklarierter Bezeichner"/"Bezeichner wurde nicht gefunden" means "undefined symbol"/"symbol not found")

    So it seems that Qt is compiled with OpenGL ES2 support by default and fails compiling OpenGL desktop support when using "-opengl desktop". This problem seems to be machine-dependent because the Qt sources do compile on my WinXP 32-bit development machine. Switching back to 4.7.2 did not change anything.

    I would really appreciate it if somebody could help me with this problem!

    Thank you,
    Andreas

    1 Reply Last reply
    0
    • A Offline
      A Offline
      andreas.hammerschmidtgmx.net
      wrote on last edited by
      #2

      Wondering if this is normal behaviour and I have to specify -no-s60 to compile without the need of EGL headers.

      1 Reply Last reply
      0
      • A Offline
        A Offline
        andreas.hammerschmidtgmx.net
        wrote on last edited by
        #3

        It seems that adding the -no-s60 switch solved the problem, but I changed too many things to be completly sure.
        I will try again with a clean source package as soon as I have some spare time.

        1 Reply Last reply
        0
        • A Offline
          A Offline
          anno
          wrote on last edited by
          #4

          I have the same problem on Windows 7 32-bit, but the -no-s60 flag did not help. Build fails on EGL :

          • Windows 7 Home Premium 32-Bit
          • Visual Studio 2010 Express SP1
          • Qt 4.7.3 Sources (from ZIP)
          • Visual Studio 2010 Command Prompt
          • QTDIR set to C:\QtSDK\Desktop\Qt\4.7.3\msvc2010

          configure -debug-and-release -opensource -shared -ltcg -no-qt3support -plugin-sql-mysql -I C:/MySQL/include -L C:/MySQL/lib -qt-sql-sqlite -phonon -phonon-backend -opengl desktop -qt-zlib -qt-gif -qt-libpng -qt-libmng -qt-libtiff -qt-libjpeg -mmx -sse2 -openssl -I C:/openssl-1.0.0d/include -L C:/openssl-1.0.0d/lib -phonon -multimedia -audio-backend -webkit -script -scripttools -mp -platform win32-msvc2010

          @...
          egl\qegl.cpp(566) : error C2065: 'EGL_NO_DISPLAY' : undeclared identifier
          egl\qeglproperties.cpp(384) : error C2065: 'EGL_DONT_CARE' : undeclared identifi
          er
          egl\qegl.cpp(568) : error C3861: 'eglGetDisplay': identifier not found
          egl\qeglproperties.cpp(387) : error C2065: 'EGL_WINDOW_BIT' : undeclared identif
          ier
          egl\qegl.cpp(570) : error C2065: 'EGL_NO_DISPLAY' : undeclared identifier
          egl\qeglproperties.cpp(389) : error C2065: 'EGL_PIXMAP_BIT' : undeclared identif
          ier
          egl\qegl.cpp(572) : error C2065: 'EGL_DEFAULT_DISPLAY' : undeclared identifier
          egl\qeglproperties.cpp(391) : error C2065: 'EGL_PBUFFER_BIT' : undeclared identi
          fier
          egl\qegl.cpp(572) : error C3861: 'eglGetDisplay': identifier not found
          egl\qeglproperties.cpp(401) : error C2065: 'EGL_WINDOW_BIT' : undeclared identif
          ier
          egl\qegl.cpp(574) : error C2065: 'EGL_NO_DISPLAY' : undeclared identifier
          egl\qeglproperties.cpp(401) : error C2065: 'EGL_PIXMAP_BIT' : undeclared identif
          ier
          egl\qegl.cpp(576) : error C2065: 'EGL_NO_DISPLAY' : undeclared identifier
          egl\qeglproperties.cpp(408) : error C2065: 'EGL_PBUFFER_BIT' : undeclared identi
          fier
          egl\qegl.cpp(579) : error C3861: 'eglInitialize': identifier not found
          egl\qeglproperties.cpp(414) : error C2065: 'EGL_CONFIG_CAVEAT' : undeclared iden
          tifier
          egl\qegl.cpp(581) : error C2065: 'EGL_NO_DISPLAY' : undeclared identifier
          egl\qeglproperties.cpp(415) : error C2065: 'EGL_DONT_CARE' : undeclared identifi
          er
          egl\qegl.cpp(587) : error C3861: 'eglGetProcAddress': identifier not found
          egl\qeglproperties.cpp(419) : error C2065: 'EGL_SLOW_CONFIG' : undeclared identi
          fier
          egl\qeglproperties.cpp(419) : fatal error C1003: error count exceeds 100; stoppi
          ng compilation
          egl\qegl.cpp(588) : error C3861: 'eglGetProcAddress': identifier not found
          egl\qegl.cpp(593) : error C3861: 'eglGetProcAddress': identifier not found
          egl\qegl.cpp(658) : error C2065: 'EGL_NO_SURFACE' : undeclared identifier
          egl\qegl.cpp(669) : error C3861: 'eglCreateWindowSurface': identifier not found
          egl\qegl.cpp(671) : error C3861: 'eglCreatePixmapSurface': identifier not found
          egl\qegl.cpp(672) : error C2065: 'EGL_NO_SURFACE' : undeclared identifier
          egl\qegl.cpp(673) : error C3861: 'eglGetError': identifier not found
          egl\qegl.cpp(712) : error C3861: 'eglGetConfigs': identifier not found
          egl\qegl.cpp(715) : error C3861: 'eglGetConfigs': identifier not found
          egl\qegl.cpp(725) : error C2065: 'EGL_EXTENSIONS' : undeclared identifier
          egl\qegl.cpp(725) : error C3861: 'eglQueryString': identifier not found
          egl\qegl.cpp(733) : error C2065: 'EGL_EXTENSIONS' : undeclared identifier
          egl\qegl.cpp(733) : error C2228: left of '.split' must have class/struct/union
          egl\qegl.cpp(733) : error C3861: 'eglQueryString': identifier not found
          NMAKE : fatal error U1077: '"C:\Program Files\Microsoft Visual Studio 10.0\VC\BI
          N\cl.EXE"' : return code '0x2'
          Stop.
          NMAKE : fatal error U1077: '"C:\Program Files\Microsoft Visual Studio 10.0\VC\BI
          N\nmake.exe"' : return code '0x2'
          Stop.
          NMAKE : fatal error U1077: 'cd' : return code '0x2'
          Stop.@

          1 Reply Last reply
          0
          • L Offline
            L Offline
            LinusA
            wrote on last edited by
            #5

            I'm not sure if this helps, but I think I had a similar problem, which I could solve a while ago. There are two things I did:

            • It's not enough to just add Qt\4.7.3\include\Qt to your VS include directories. I also had to add D:\Qt\4.7.3\include\QtOpenGL after that.
            • As Windows (and the Win SDK) comes with ancient OpenGL header files from the stone-age, I use Glew for my projects: http://glew.sourceforge.net/ . It boils down to 1 more include directory, 1 more lib dependance, and 1 init statement in your QGLWidgets. I'm very happy with it.
            1 Reply Last reply
            0
            • V Offline
              V Offline
              vochinin
              wrote on last edited by
              #6

              [quote author="LinusA" date="1311005327"]I'm not sure if this helps, but I think I had a similar problem, which I could solve a while ago. There are two things I did:

              • It's not enough to just add Qt\4.7.3\include\Qt to your VS include directories. I also had to add D:\Qt\4.7.3\include\QtOpenGL after that.
              • As Windows (and the Win SDK) comes with ancient OpenGL header files from the stone-age, I use Glew for my projects: http://glew.sourceforge.net/ . It boils down to 1 more include directory, 1 more lib dependance, and 1 init statement in your QGLWidgets. I'm very happy with it.
                [/quote]
                Hi, LinusA.
                Thank you for your advices I followed the link you proposed, downloaded libs and headers. I add glew32.lib to my VS project, add #include <GL/glew.h>" in my header, placed glew32.dll to exe file. I have successfully compiled project with functions I couldn't compile before (glHistogram). Now I have runtime error

              bq. bq. Unhandled exception at 0x00000000 in glka.exe: 0xC0000005: Access violation reading location 0x00000000.

              on line

              @glHistogram(GL_HISTOGRAM,256*256,GL_LUMINANCE, GL_FALSE);@

              I tested a pointer recieved from

              @(PFNGLHISTOGRAMPROC)wglGetProcAddress("PFNGLHISTOGRAMPROC") @

              and it is NULL. Now I wonder if it means that my hardware doesn't support this function (I tested on two computers with the same effect) or my project has wrong settings. You wrote that there should be some init statement in OGLWigets - maybe this is my problem.
              I'm new in both Qt and opengl and exuse if I'm asking some stupid question. I would be very pleased if you would tell me what i am doing wrong.

              1 Reply Last reply
              0
              • L Offline
                L Offline
                LinusA
                wrote on last edited by
                #7

                [quote author="vochinin" date="1311775500"]
                Thank you for your advices I followed the link you proposed, downloaded libs and headers. I add glew32.lib to my VS project, add #include <GL/glew.h>" in my header, placed glew32.dll to exe file.
                [/quote]
                Maybe it's the order of libraries you add? I have
                @
                qtmain.lib
                QtCore4.lib
                QtGui4.lib
                // other stuff...
                glew32.lib
                QtOpenGL4.lib
                opengl32.lib
                glu32.lib
                @
                I think glew has to be first!
                I also have #include <GL/glew.h> before any Qt stuff!

                [quote author="vochinin" date="1311775500"]
                You wrote that there should be some init statement in OGLWigets - maybe this is my problem.
                I'm new in both Qt and opengl and exuse if I'm asking some stupid question. I would be very pleased if you would tell me what i am doing wrong. [/quote]
                I'm an OpenGL-newbie, too. Also I've not heard of glHistogram(). Anyway, you have to call glewInit(), and I think you have to do it before any other gl* statement, but when you already have the GL context. So I've got it here:
                @
                void MyGLWidget::initializeGL() {
                glewInit();
                // ... other stuff
                @

                Maybe you have to activate / enable some OpenGL "addons" or "extensions", too? See glew docs..

                1 Reply Last reply
                0
                • V Offline
                  V Offline
                  vochinin
                  wrote on last edited by
                  #8

                  Thank you very much for quick reply. I also noticed that i should include glew.h before

                  bq. any Qt stuff

                  as in other way it gives compilation error. But I don't mind about linking order, and i didn't do glewInit(). I believe this could help me. I'll try these tips tomorrow and write back.

                  1 Reply Last reply
                  0
                  • V Offline
                    V Offline
                    vochinin
                    wrote on last edited by
                    #9

                    Finally. I changed linking order as you wrote and it fixed some bug with my autocomplete in VS (It didn't display some variables and constants i could use). I also add glewInit() but i haven't noticed any differnces yet:). Yet glHistogram still doesn't work, now i think that the reason of my run-time error was in the hardware that doesn't support glHistogram. I tried glGenBuffersARB that also was not present before glew.h include and I could recieve pointer and run it. 3 computers I used for tests of glHistogram don't support it. Nevetheless it's good that I can use some other beneficial functions of glew. Thanks for your help.

                    1 Reply Last reply
                    0
                    • L Offline
                      L Offline
                      LinusA
                      wrote on last edited by
                      #10

                      [quote author="vochinin" date="1311845828"]Finally. I changed linking order as you wrote and it fixed some bug with my autocomplete in VS (It didn't display some variables and constants i could use).[/quote]
                      Yes, that was the case with me, too. The reason might also be glew.h. If autocomplete has problems, you should go to your solution directory and delete the .ncb (or called differently in VS2010) file, the big autocomplete database. Then restart VS, and it should build it again cleanly from scratch...

                      If everything is working now, you could add a "[Solved]" to the thread title.

                      1 Reply Last reply
                      0
                      • V Offline
                        V Offline
                        vochinin
                        wrote on last edited by
                        #11

                        bq. If autocomplete has problems, you should go to your solution directory and delete the .ncb

                        Thanks for the tip.

                        bq. If everything is working now, you could add a “[Solved]” to the thread title.

                        Evrethyng is working. I'm new to that forum but I think thread creator should mark it as "solved". It seems topic starter had a little bit another problem.

                        1 Reply Last reply
                        0
                        • L Offline
                          L Offline
                          LinusA
                          wrote on last edited by
                          #12

                          [quote author="vochinin" date="1311861449"]
                          Evrethyng is working. I'm new to that forum but I think thread creator should mark it as "solved". It seems topic starter had a little bit another problem. [/quote]
                          Ah ok, you're not the thread-starter -- sorry my confusion ;)

                          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