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 shader functions not working
QtWS25 Last Chance

OpenGL shader functions not working

Scheduled Pinned Locked Moved General and Desktop
openglqt 5.4.0
8 Posts 2 Posters 3.1k 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
    Jordan69
    wrote on last edited by
    #1

    Hi, i am using Qt version 5.4.1. My gpu can support OpenGL version 4.2 but functions such as glCreateShader or glCompileShader etc. do not work. Other functions such as glGenBuffers work perfectly fine. I am using QOpenGLFunctions and i have called initializeOpenGLFunctions in my initializeGL() function. I am very sorry if this is a noob question as i am new to Qt and OpenGL. Thanks!

    1 Reply Last reply
    0
    • ? Offline
      ? Offline
      A Former User
      wrote on last edited by
      #2

      Hi Jordan69!

      There is an example in the docs that shows how to use QOpenGLShaderProgram: http://doc.qt.io/qt-5/qtquick-scenegraph-openglunderqml-example.html

      Hope that helps :-)

      J 3 Replies Last reply
      0
      • ? A Former User

        Hi Jordan69!

        There is an example in the docs that shows how to use QOpenGLShaderProgram: http://doc.qt.io/qt-5/qtquick-scenegraph-openglunderqml-example.html

        Hope that helps :-)

        J Offline
        J Offline
        Jordan69
        wrote on last edited by
        #3

        @Wieland

        Thanks ill check it out!

        1 Reply Last reply
        0
        • ? A Former User

          Hi Jordan69!

          There is an example in the docs that shows how to use QOpenGLShaderProgram: http://doc.qt.io/qt-5/qtquick-scenegraph-openglunderqml-example.html

          Hope that helps :-)

          J Offline
          J Offline
          Jordan69
          wrote on last edited by Jordan69
          #4

          @Wieland

          Ok I got a question, with QOpenGLShaderProgram, all I have to do is add the header right?

          ? 1 Reply Last reply
          0
          • J Jordan69

            @Wieland

            Ok I got a question, with QOpenGLShaderProgram, all I have to do is add the header right?

            ? Offline
            ? Offline
            A Former User
            wrote on last edited by
            #5

            @Jordan69 Yes:

            #include <QtGui/QOpenGLShaderProgram>

            J 1 Reply Last reply
            0
            • ? A Former User

              @Jordan69 Yes:

              #include <QtGui/QOpenGLShaderProgram>

              J Offline
              J Offline
              Jordan69
              wrote on last edited by
              #6

              @Wieland

              Thank you so much Wieland.

              1 Reply Last reply
              0
              • ? A Former User

                Hi Jordan69!

                There is an example in the docs that shows how to use QOpenGLShaderProgram: http://doc.qt.io/qt-5/qtquick-scenegraph-openglunderqml-example.html

                Hope that helps :-)

                J Offline
                J Offline
                Jordan69
                wrote on last edited by
                #7

                @Wieland

                Am I meant to put shaders in a specific function like initializeGL?

                ? 1 Reply Last reply
                0
                • J Jordan69

                  @Wieland

                  Am I meant to put shaders in a specific function like initializeGL?

                  ? Offline
                  ? Offline
                  A Former User
                  wrote on last edited by
                  #8

                  @Jordan69 No, you can compile your shaders and link them whenever you need them. But keep in mind that your shaders are compiled by the GPU at runtime. So, compilation takes time and you can't afford to do this everytime you render a single frame. Thus it's wise to have some init function that is called only on startup or when you need to make changes to your shader program(s).

                  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