We are curently plotting up to 64 graphs in an ECG style (starting again after few seconds and replacing the previous data). Data is received at 2kHz via ethernet and inserted in a separate thread in batches (not one by one). We use a QTimer to replot every 50 ms. Some graphs have their own QCustomPlots (based on device setup).
We encountered some performance issues with the max number of graphs so we tried to use hardware acceleration with OpenGL to free up the CPU, but the actual plotting performances became much worse.
We noticed that
painter->drawImage(0, 0, mGlPBuffer->toImage());
takes around 7 ms for each buffer with OpenGL, and that QImages are quite worse than QPixmap for data visualisation.
After that we inspected
painter->drawPixmap(0, 0, mBuffer);
which takes around 0.6 ms for every buffer.
How could we efficiently visualize data by using or altering the QCustomPlot's OpenGL logic?
We also tried:
1. Putting our QCustomPlots with disabled OpenGL into QOpenGLWidgets, the performances are somewhat satisfying and the raster pixmaps are being visualized using hardware acceleration (correct me if I'm wrong), but our graphs are sometimes distorsed (probably caused by outer interference).
2. Putting QCustomPlots with enabled OpenGL into QOpenGLWidgets, and setting a shared QOpenGLContext between our widgets and QCustomPlot's mGlContext, which didn't improve any performaces to the basic setOpenGL inside a QWidget and even caused weird plot flickering when there is more than one plot on the screen.