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. What's the difference between drawing using QPainter and OpenGL for 2D objects
Forum Updated to NodeBB v4.3 + New Features

What's the difference between drawing using QPainter and OpenGL for 2D objects

Scheduled Pinned Locked Moved Unsolved General and Desktop
9 Posts 2 Posters 1.4k 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.
  • S Offline
    S Offline
    student
    wrote on last edited by
    #1

    what's the difference between a drawing using QPainter and OpenGL for 2D objects? speed difference?

    1 Reply Last reply
    0
    • mrjjM Offline
      mrjjM Offline
      mrjj
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi
      yes openGL will use the GPU and QPainter will not. ( hardware acceleration=
      So openGL can be faster.

      S 1 Reply Last reply
      1
      • mrjjM mrjj

        Hi
        yes openGL will use the GPU and QPainter will not. ( hardware acceleration=
        So openGL can be faster.

        S Offline
        S Offline
        student
        wrote on last edited by
        #3

        @mrjj if I don't have GPU, I mean both of them can only use CPU to render 2D shapes, any difference?

        mrjjM 1 Reply Last reply
        0
        • S student

          @mrjj if I don't have GPU, I mean both of them can only use CPU to render 2D shapes, any difference?

          mrjjM Offline
          mrjjM Offline
          mrjj
          Lifetime Qt Champion
          wrote on last edited by
          #4

          @student
          Hi
          openGL needs a GPU.
          But lets say it was a software openGL render.
          Then QPainter might be faster for some stuff.

          1 Reply Last reply
          0
          • mrjjM Offline
            mrjjM Offline
            mrjj
            Lifetime Qt Champion
            wrote on last edited by
            #5

            Hi
            But what do you want to make?
            The requirement for your app will tell if openGL or QPainter is the best choice.
            Or maybe QML.

            S 1 Reply Last reply
            0
            • mrjjM mrjj

              Hi
              But what do you want to make?
              The requirement for your app will tell if openGL or QPainter is the best choice.
              Or maybe QML.

              S Offline
              S Offline
              student
              wrote on last edited by
              #6

              @mrjj thanks for your reply. I am trying to develop a software which can render some 2D shapes, I don't have GPU, just a general software can be used anywhere. So, want to figure out the advantage and disadvantages of QPainter & OpenGL, then, decide to choose one of them to move on.

              mrjjM 1 Reply Last reply
              0
              • S student

                @mrjj thanks for your reply. I am trying to develop a software which can render some 2D shapes, I don't have GPU, just a general software can be used anywhere. So, want to figure out the advantage and disadvantages of QPainter & OpenGL, then, decide to choose one of them to move on.

                mrjjM Offline
                mrjjM Offline
                mrjj
                Lifetime Qt Champion
                wrote on last edited by
                #7

                @student
                Well openGL needs a GPU so its out if you dont have one. (well you do but it might no do openGL)

                So what do you need to do with these 2d shapes ?

                S 1 Reply Last reply
                0
                • mrjjM mrjj

                  @student
                  Well openGL needs a GPU so its out if you dont have one. (well you do but it might no do openGL)

                  So what do you need to do with these 2d shapes ?

                  S Offline
                  S Offline
                  student
                  wrote on last edited by
                  #8

                  @mrjj just a sw to draw shapes and can edit these shapes using Qt. looks even I don't have GPU, I can use QGLWidget and OpenGL on CPU, it seems also work.
                  Before moving on, want to do a survey about QPainter and OpenGL.

                  mrjjM 1 Reply Last reply
                  0
                  • S student

                    @mrjj just a sw to draw shapes and can edit these shapes using Qt. looks even I don't have GPU, I can use QGLWidget and OpenGL on CPU, it seems also work.
                    Before moving on, want to do a survey about QPainter and OpenGL.

                    mrjjM Offline
                    mrjjM Offline
                    mrjj
                    Lifetime Qt Champion
                    wrote on last edited by
                    #9

                    @student
                    hi
                    There is always a GPU as else nothing can be shown on screen.
                    So if QGLWidget works it means your build in GPU does support openGL.

                    QPainter has a much richer command set. with OpenGL, it would be from scratch.
                    But it can also be combined

                    https://doc.qt.io/qt-5/qtopengl-2dpainting-example.html

                    1 Reply Last reply
                    1

                    • Login

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