madduci
madduci

Reputation: 2883

QImage vs OpenGL Performance

I'm porting an old 4.8 application to 5.2.1 and back in that time, I used QImage to render some raw data on the screen, in a QLabel.

I am grabbing images from a camera, so i want to display those images in real-time. Until now, with QImage, i achieve over 20FPS (the camera is able to grab 30 FPS).

I'm wondering if rendering this data on OpenGL (maybe in a QML Quick / Qt Widgets new application) would be faster than the current developed method?

Upvotes: 0

Views: 669

Answers (1)

BЈовић
BЈовић

Reputation: 64223

With next assumptions in mind :

  • your implementation in OpenGL is using HW acceleration
  • your implementation is using optimal texture parameters, to display the image (i.e. the driver is not doing some conversion)

you may achieve better performances using OpenGL. QImage still has to hold data at both the memory and GPU, meaning at least one additional copy is needed when updating QImage. With OpenGL, you can copy data directly to GPU memory and you do not need to store the data somewhere in memory.

However, what may be optimal on one GPU, doesn't have to be optimal on another. So, if you are implementing something that needs to run on various hardware, I would advise to go for QImage.

But as said, the only way is to implement and measure.

Upvotes: 2

Related Questions