Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Game Development
  4. [Solved] Deploy OpenGL shader app in older computers

[Solved] Deploy OpenGL shader app in older computers

Scheduled Pinned Locked Moved Game Development
9 Posts 2 Posters 8.7k 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.
  • J Offline
    J Offline
    john_god
    wrote on 23 Dec 2012, 20:59 last edited by
    #1

    If one sucessfully compiles a OpenGL 3.x or 4.x project and tries do deploy it to old PC's with grafic cards that doenst support advanced OpenGL versions what happens ? The program will fail or it will fallback to software rendering (slower) ? Or it depends on the driver ?

    1 Reply Last reply
    0
    • Z Offline
      Z Offline
      ZapB
      wrote on 24 Dec 2012, 14:17 last edited by
      #2

      It will fail. Your application should check the version of the OpenGL context that was actually created and provide alternative rendering approaches or at least inform the user gracefully. See QOpenGLContext::format() and QSurfaceFormat for more info.

      The software renderer on Windows is OpenGL 1.1 only. On Linux/Mac you will likely get newer than that but never OpenGL 4 in software afaik.

      Nokia Certified Qt Specialist
      Interested in hearing about Qt related work

      1 Reply Last reply
      0
      • J Offline
        J Offline
        john_god
        wrote on 24 Dec 2012, 17:33 last edited by
        #3

        Thanks for answering ZapB.
        I just tested this example "http://qt-project.org/wiki/How_to_use_OpenGL_Core_Profile_with_Qt":http://qt-project.org/wiki/How_to_use_OpenGL_Core_Profile_with_Qt (wich I believe you wrote it :) ) in my Wetab that has OpenGL 1.5 hardware support, with an ubuntu based distro. In fact it fails miserably

        @X Error: BadRequest (invalid request code or no such operation) 1
        Extension: 153 (Uknown extension)
        Minor opcode: 34 (Unknown request)
        Resource id: 0x1a00005
        Could not enable sample buffers
        QGLShader::compile(Vertex): 0:1(10): error: GLSL 3.30 is not supported. Supported versions are: 1.00 ES, 1.10, and 1.20

        "0:1(10): error: GLSL 3.30 is not supported. Supported versions are: 1.00 ES, 1.10, and 1.20

        "
        QGLShader::compile(Fragment): 0:1(10): error: GLSL 3.30 is not supported. Supported versions are: 1.00 ES, 1.10, and 1.20

        0:6(8): error: unrecognized layout identifier `location'

        "0:1(10): error: GLSL 3.30 is not supported. Supported versions are: 1.00 ES, 1.10, and 1.20

        0:6(8): error: unrecognized layout identifier `location'
        " @

        But then again, with some minor changes to the shaders:

        @void main(void)
        {
        gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );
        }@

        @attribute vec4 vertex;
        void main(void)
        {
        gl_Position = vertex;
        }@

        and adding a default empty constructor to GLWidget, and initialising variable w without glFormat, it works beatifull without errors, displaint that red triangle.

        So now I'm confused, I'm using a shaders program, don't know what version, on a OpenGL hardware 1.5 version, so for sure it must be falling back to software rendering ? Also someone knows a similar program to OpenGL Extensions Viewer, for linux, to check OpenGL hardware capabilities ?

        1 Reply Last reply
        0
        • Z Offline
          Z Offline
          ZapB
          wrote on 24 Dec 2012, 18:14 last edited by
          #4

          According to http://en.wikipedia.org/wiki/GLSL#Versions GLSL version 1.2 corresponds to OpenGL 2.1.

          So apparently your hardware does support programmable shaders. The small chanegs you made are to adapt to the GLSL 1.2 syntax. It is not uncommon to ship several shader versions for different versions of GLSL/OpenGL or different rendering techniques and then to choose between them at runtime depending upon what your system supports.

          Nokia Certified Qt Specialist
          Interested in hearing about Qt related work

          1 Reply Last reply
          0
          • Z Offline
            Z Offline
            ZapB
            wrote on 24 Dec 2012, 18:27 last edited by
            #5

            To see which versions your system supports take a look at http://qt-project.org/doc/qt-5.0/qtopengl/qglformat.html#openGLVersionFlags

            Alternatively request an OpenGL 4.3 context and see what you actually get back. That should be the maximum supported version.

            For extensions, see QOpenGLContext::extensions() http://qt-project.org/doc/qt-5.0/qtgui/qopenglcontext.html#extensions

            Hope this helps.

            Nokia Certified Qt Specialist
            Interested in hearing about Qt related work

            1 Reply Last reply
            0
            • J Offline
              J Offline
              john_god
              wrote on 28 Dec 2012, 05:12 last edited by
              #6

              Thanks for your answer, I beggining to see the light. Just another question, regarding Windows, what's the deal with Glee and Glew libraries? I have read about them, but not sure if I really understood what they do under the wood. I guess they are just libraries that, because OpenGL is frozen in Windows to 1.1, implement the recent versions, and I guess I wont be needing them has long I use Qt OpenGL, only if I go with native OpenGL, right ?

              1 Reply Last reply
              0
              • Z Offline
                Z Offline
                ZapB
                wrote on 28 Dec 2012, 09:26 last edited by
                #7

                Right, Glee and GLEW basically do the equivalent of this:

                @
                foreach(OpenGL Version) {
                foreach(OpenGL Function in Version)
                function = QOpenGLContext::getProcAddress(functionName)
                }

                foreach(OpenGLExtension) {
                foreach(OpenGL Function in Extension)
                extensionFunction = QOpenGLContext::getProcAddress(extensionFunctionName)
                }
                @

                The Qt OpenGL classes do this function pointer resolution for you for the functions that they use. However if you wish to use the latest OpenGL 3/4 features then you will need to resolve those functions yourself - for now.

                I hope to get functionality included in Qt 5.1 that does the equivalent of Glee/GLEW. See https://codereview.qt-project.org/#change,35408 for example.

                Nokia Certified Qt Specialist
                Interested in hearing about Qt related work

                1 Reply Last reply
                0
                • J Offline
                  J Offline
                  john_god
                  wrote on 28 Dec 2012, 12:29 last edited by
                  #8

                  Thanks for the info.
                  Marking this as solved, have yourself a happy new year :)

                  1 Reply Last reply
                  0
                  • Z Offline
                    Z Offline
                    ZapB
                    wrote on 28 Dec 2012, 13:08 last edited by
                    #9

                    Thank you. Happy New Year to you too!

                    Nokia Certified Qt Specialist
                    Interested in hearing about Qt related work

                    1 Reply Last reply
                    0

                    1/9

                    23 Dec 2012, 20:59

                    • Login

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