A
A
alexey_abramov2015-12-13 19:56:35
Qt
alexey_abramov, 2015-12-13 19:56:35

Qt game development - QOpenGL or QGraphicsScene? Or are there other options?

Hello.
I am writing a third game on Qt, and the question arose of choosing a 2D graphics engine.
Previously, without hesitation, I wrote through QGraphicsScene. Very comfortably. In one game, there were no generated objects that change their position on a timer, in another game there were no more than 5 of them in one state. Everything was ok.
Now, in the new game, there are approximately 25 elements maximum, which change their state on a timer. The application starts acting weird when there are more than 20 of them
. QTimer with an interval of 5 actually starts to work as a timer with an interval several times longer. As soon as the objects are deleted and there are fewer of them - the timer is "recovered", the application stops working slowly. And the processor is loaded immediately by 50%.
It seems that the computer is normal, but such glitches disappointed. Are there any options to somehow optimize QGraphicsScene? Or is it still better to sit down and rewrite the code in QOpenGL? How is he doing with the same load?
I just spent a lot of time, I would like to know how to optimize the work, but if, after all, the graphic scene is really not an option for games, then you will have to rewrite it. And are there other graphics engines in Qt/Qt-supported? Immediately I would like to choose the most optimal.
Thanks

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Stanislav Silin, 2015-12-13
@alexey_abramov

Of course, it all depends on the logic of your game and the severity of your resources. If everything is simple here, then rendering 25 shapes is not difficult. Perhaps you have a problem in the rendering logic itself, somewhere a lot of extra gestures are being made. It's hard to say more precisely... There shouldn't be any problems with the performance of the Qt pipeline. Maybe I'm wrong, of course, but in my practice everything flew quickly.

N
Neonoviiwolf, 2015-12-13
@Neonoviiwolf

Are you using vector drawings by any chance?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question