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 right way to draw 2D graphics with opengl support in qt(c++)?
Forum Updated to NodeBB v4.3 + New Features

What's the right way to draw 2D graphics with opengl support in qt(c++)?

Scheduled Pinned Locked Moved Unsolved General and Desktop
7 Posts 3 Posters 1.8k Views 2 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.
  • I Offline
    I Offline
    Isolde
    wrote on last edited by
    #1

    What's the right way to draw 2D graphics with opengl support in qt(c++)?

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

      Hi,

      What exactly do you want to draw ?
      What's your application purpose ?
      Are you going to use widgets or Qt Quick ?
      What platform are you targeting ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      I 1 Reply Last reply
      1
      • SGaistS SGaist

        Hi,

        What exactly do you want to draw ?
        What's your application purpose ?
        Are you going to use widgets or Qt Quick ?
        What platform are you targeting ?

        I Offline
        I Offline
        Isolde
        wrote on last edited by Isolde
        #3

        @SGaist Thank you for your reply! I'm coding a program with a large amount of moving text effect for Linux PC platform. And I think it's better not to use QML(I hate Javascript). Up to now, I'm using QLabel with QPropertyAnimation, but it has poor performance. So I wonder what the right way to draw 2D graphics with Hardware Acceleration(like OpenGL) is?

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          You can use the graphics view framework with a QOpenGLWidget as view port to get acceleration or do everything in OpenGL from Qt directly.

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          I 1 Reply Last reply
          1
          • SGaistS SGaist

            You can use the graphics view framework with a QOpenGLWidget as view port to get acceleration or do everything in OpenGL from Qt directly.

            I Offline
            I Offline
            Isolde
            wrote on last edited by
            #5

            @SGaist I'm now trying with QOpenGLWidget, but I have a new question: How can I render these graphics in another thread?

            jsulmJ 1 Reply Last reply
            0
            • I Isolde

              @SGaist I'm now trying with QOpenGLWidget, but I have a new question: How can I render these graphics in another thread?

              jsulmJ Offline
              jsulmJ Offline
              jsulm
              Lifetime Qt Champion
              wrote on last edited by
              #6

              @Isolde I don't think you can as all UI related stuff must be done in GUI thread.

              https://forum.qt.io/topic/113070/qt-code-of-conduct

              1 Reply Last reply
              0
              • SGaistS Offline
                SGaistS Offline
                SGaist
                Lifetime Qt Champion
                wrote on last edited by SGaist
                #7

                You have to take special care for the context see the details of the QOpenGLContext class.

                You should also take a look at the Qt OpenGL examples, the Threaded QOpenGLWidget is likely one that you will be interested in.

                Interested in AI ? www.idiap.ch
                Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                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