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. Qt 5 - OpenGL Problem

Qt 5 - OpenGL Problem

Scheduled Pinned Locked Moved General and Desktop
34 Posts 7 Posters 31.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.
  • D Offline
    D Offline
    DamianPrg
    wrote on 7 Jan 2013, 17:59 last edited by
    #1

    Hello.

    My problem is that I cannot use OpenGL 2 functions, some which I can use are glClear, glClearColor, but I cant use glBegin for example.

    I added QT += opengl in project file.

    Can anyone help? Thanks

    N 1 Reply Last reply 9 Sept 2015, 07:48
    0
    • Z Offline
      Z Offline
      ZapB
      wrote on 8 Jan 2013, 08:26 last edited by
      #2

      What do you mean by "can't use"? Do you get a compile error, link error, runtime error?

      Nokia Certified Qt Specialist
      Interested in hearing about Qt related work

      1 Reply Last reply
      0
      • D Offline
        D Offline
        DamianPrg
        wrote on 9 Jan 2013, 18:16 last edited by
        #3

        [quote author="ZapB" date="1357633595"]What do you mean by "can't use"? Do you get a compile error, link error, runtime error?[/quote]

        When I use glBegin, glVertex3f I get identifer 'X' not found.

        X - function which I want to call (OpenGL function).

        1 Reply Last reply
        0
        • Z Offline
          Z Offline
          ZapB
          wrote on 10 Jan 2013, 09:16 last edited by
          #4

          Oh boy this really needs to go into an FAQ somewhere. Let me guess, you are using the pre-compiled Qt5 SDK on Windows? If so that is the cause of your problem. Let me explain.

          The precompiled binary packages ship with Qt5 configured for OpenGL ES 2 and using the ANGLE layer which implements ES 2 on top of DirectX. This was done to ensure that QtQuick2 works on all windows machines, even those with crappy Intel OpenGL drivers.

          To get access to glBegin() etc which are not part of OpenGL ES 2 you need to build your own Qt5 and pass in the -opengl desktop option to configure.

          Qt 5.0.1 should hopefully also ship with such a pre-compiled Qt. Please go and vote for this bug https://bugreports.qt-project.org/browse/QTBUG-28715

          Nokia Certified Qt Specialist
          Interested in hearing about Qt related work

          1 Reply Last reply
          0
          • D Offline
            D Offline
            DamianPrg
            wrote on 10 Jan 2013, 19:35 last edited by
            #5

            [quote author="ZapB" date="1357809361"]Oh boy this really needs to go into an FAQ somewhere. Let me guess, you are using the pre-compiled Qt5 SDK on Windows? If so that is the cause of your problem. Let me explain.

            The precompiled binary packages ship with Qt5 configured for OpenGL ES 2 and using the ANGLE layer which implements ES 2 on top of DirectX. This was done to ensure that QtQuick2 works on all windows machines, even those with crappy Intel OpenGL drivers.

            To get access to glBegin() etc which are not part of OpenGL ES 2 you need to build your own Qt5 and pass in the -opengl desktop option to configure.

            Qt 5.0.1 should hopefully also ship with such a pre-compiled Qt. Please go and vote for this bug https://bugreports.qt-project.org/browse/QTBUG-28715

            [/quote]

            Ok thanks, I will try to compile it by myself, Thank again :-)

            1 Reply Last reply
            0
            • U Offline
              U Offline
              utcenter
              wrote on 10 Jan 2013, 20:12 last edited by
              #6

              People still use glBegin? Don't!!!

              1 Reply Last reply
              0
              • D Offline
                D Offline
                DamianPrg
                wrote on 10 Jan 2013, 20:15 last edited by
                #7

                [quote author="utcenter" date="1357848726"]People still use glBegin? Don't!!![/quote]

                Often I use modern opengl (3.2), but for simple 2d editor, I should be allright with VA and fixed OpenGL 2.1.

                1 Reply Last reply
                0
                • U Offline
                  U Offline
                  utcenter
                  wrote on 10 Jan 2013, 20:18 last edited by
                  #8

                  The fixed function pipeline is left only for the sake of backward compatibility, only for code that already exists, if you write new code, it is very counter-productive to use it. You don't really gain anything by using it, you lose out on many features that are beneficial even in 2d, and in many cases, performance is actually worse, plus you lose portability.

                  1 Reply Last reply
                  0
                  • Z Offline
                    Z Offline
                    ZapB
                    wrote on 10 Jan 2013, 20:31 last edited by
                    #9

                    If you are writing new code then I would also recommend avoiding the old fixed function pipeline stuff. Note that some vendors (notably Apple) do not implement the compatibility profile. So if you need a 3.2 context on OS X you can only use the Core profile. Just something to bear in mind.

                    Nokia Certified Qt Specialist
                    Interested in hearing about Qt related work

                    1 Reply Last reply
                    0
                    • D Offline
                      D Offline
                      DamianPrg
                      wrote on 10 Jan 2013, 21:06 last edited by
                      #10

                      [quote author="ZapB" date="1357849860"]If you are writing new code then I would also recommend avoiding the old fixed function pipeline stuff. Note that some vendors (notably Apple) do not implement the compatibility profile. So if you need a 3.2 context on OS X you can only use the Core profile. Just something to bear in mind.[/quote]

                      Anyway if i want to use OpenGL 3.2+, i need compiile qt by myself.

                      1 Reply Last reply
                      0
                      • M Offline
                        M Offline
                        mgonzalo
                        wrote on 16 Jan 2013, 12:20 last edited by
                        #11

                        Hi guys!

                        I've got exactly the same problem as DamianPrg.

                        Maybe this is a stupid question, but I am a very beginner, anyway : what do you mean by saying that you need to compile Qt by yourself ?

                        1 Reply Last reply
                        0
                        • D Offline
                          D Offline
                          DamianPrg
                          wrote on 16 Jan 2013, 12:22 last edited by
                          #12

                          [quote author="mgonzalo" date="1358338826"]Hi guys!

                          I've got exactly the same problem as DamianPrg.

                          Maybe this is a stupid question, but I am a very beginner, anyway : what do you mean by saying that you need to compile Qt by yourself ?

                          [/quote]

                          You can compile it by yourself, I tried but didn't work. Some problem with configure.
                          Or you can wait for next release of Qt 5, and maybe there will be OpenGL desktop instead of GL ES 2.

                          Note: If you want compile it by yourself, it will take some time, on good machine about 1h :-)

                          1 Reply Last reply
                          0
                          • Z Offline
                            Z Offline
                            ZapB
                            wrote on 16 Jan 2013, 12:24 last edited by
                            #13

                            Well, just that you need to compile your own build of the Qt libraries to enable Desktop OpenGL on windows at present. Helpful instructions can be found at http://qt-project.org/wiki/Building_Qt_5_from_Git

                            Nokia Certified Qt Specialist
                            Interested in hearing about Qt related work

                            1 Reply Last reply
                            0
                            • D Offline
                              D Offline
                              DamianPrg
                              wrote on 16 Jan 2013, 12:25 last edited by
                              #14

                              http://www.youtube.com/watch?v=K0O6mvD6uk4 - It also can help you :-)

                              1 Reply Last reply
                              0
                              • sierdzioS Offline
                                sierdzioS Offline
                                sierdzio
                                Moderators
                                wrote on 16 Jan 2013, 12:27 last edited by
                                #15

                                Qt is a set of libraries and tools. What you download from Qt Project web site is - most probably - a pack of precompiled libraries, ready to be used. Necessarily, this general package is compiled with default, fit-for-all settings.

                                However, Qt is a big project, and can be compiled in thousands of ways (by passing flags to configure script) and for some usages it's better to define those flags as you want to.

                                Qt Project is open sourced, you can download sources yourself and take a look ("link":http://qt-project.org/wiki/Building_Qt_5_from_Git).

                                EDIT whoosh, I was waaaay too slow on this one ;)

                                (Z(:^

                                1 Reply Last reply
                                0
                                • D Offline
                                  D Offline
                                  DamianPrg
                                  wrote on 16 Jan 2013, 12:31 last edited by
                                  #16

                                  @

                                  C:\qt5>configure -developer-build -opensource -opengl desktop -nomake examples -
                                  nomake tests

                                  • C:/qt5/qtbase/configure -developer-build -opensource -opengl desktop -nomake e
                                    xamples -nomake tests
                                    'C:\qt5\qtbase\configure.exe' is not recognized as an internal or external comm
                                    and,
                                    operable program or batch file.
                                    *** qtbase/configure exited with non-zero status.

                                  C:\qt5>
                                  @

                                  This is what I get when I try to configure. Note that i have Perl, Python installed. Source code is downloaded from http://qt-project.org/downloads

                                  1 Reply Last reply
                                  0
                                  • sierdzioS Offline
                                    sierdzioS Offline
                                    sierdzio
                                    Moderators
                                    wrote on 16 Jan 2013, 12:34 last edited by
                                    #17

                                    On Windows, you need to rdowload the .zip file, not tarball. Also, I think you need to run configure.exe, not the configure script. I'm using Linux, though, this info is second-hand at best ;)

                                    (Z(:^

                                    1 Reply Last reply
                                    0
                                    • Z Offline
                                      Z Offline
                                      ZapB
                                      wrote on 16 Jan 2013, 12:35 last edited by
                                      #18

                                      Probably best to get a git clone as it is easier to get back to a clean state. Also it makes sure you have the same exact source tree as the Qt devs so it's easier to trouble shoot. The packaging may remove some files needed to do a fresh build. Does the configure.exe actually exist at that path?

                                      Nokia Certified Qt Specialist
                                      Interested in hearing about Qt related work

                                      1 Reply Last reply
                                      0
                                      • D Offline
                                        D Offline
                                        DamianPrg
                                        wrote on 16 Jan 2013, 12:39 last edited by
                                        #19

                                        [quote author="sierdzio" date="1358339671"]On Windows, you need to rdowload the .zip file, not tarball. Also, I think you need to run configure.exe, not the configure script. I'm using Linux, though, this info is second-hand at best ;)[/quote]

                                        I tried ZIP, but it wont extract on my PC. Do you think thats problem? Because Tarball is often used on linux?

                                        @ZapB - Does the configure.exe actually exist at that path?

                                        No, just .bat and one with no extenstion.

                                        1 Reply Last reply
                                        0
                                        • sierdzioS Offline
                                          sierdzioS Offline
                                          sierdzio
                                          Moderators
                                          wrote on 16 Jan 2013, 12:45 last edited by
                                          #20

                                          Qt packaging strips tarballs of things that are not needed on unix (so, Windows stuff is missing there), and uses unix line endings. So you need the .zip.

                                          As ZapB mentioned, using git is a much better idea.

                                          (Z(:^

                                          1 Reply Last reply
                                          0

                                          1/34

                                          7 Jan 2013, 17:59

                                          • Login

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