What's the right way to draw 2D graphics with opengl support in qt(c++)?
-
wrote on 3 Dec 2017, 12:16 last edited by
What's the right way to draw 2D graphics with opengl support in qt(c++)?
-
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 ? -
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 ?wrote on 4 Dec 2017, 02:27 last edited by Isolde 12 Apr 2017, 02:28@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?
-
You can use the graphics view framework with a QOpenGLWidget as view port to get acceleration or do everything in OpenGL from Qt directly.
-
You can use the graphics view framework with a QOpenGLWidget as view port to get acceleration or do everything in OpenGL from Qt directly.
-
@SGaist I'm now trying with QOpenGLWidget, but I have a new question: How can I render these graphics in another thread?
@Isolde I don't think you can as all UI related stuff must be done in GUI thread.
-
Lifetime Qt Championwrote on 5 Dec 2017, 08:02 last edited by SGaist 12 May 2017, 08:30
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.
1/7