3

I'm developing a realtime log plotter using Qt Quick 2. It receives log data like every millisecond, and I'd like to plot it incrementally (to a parametric curve) using a custom QQuickItem.

Currently I'm planning to use QSGGeometry and send vertex data to GPU. However, since QSGGeometry does not support incremental vertex upload, I will have to send all vertices every frame. Since the log can be about a hundred second long, I will be sending hundreds of thousands of vertices every frame. I feel myself silly to do that every sixtieth second.

Of course I could prune unnecessary vertices(those that are too close to others) and make the vertex buffer size maybe 1/30, but I noticed that was just bringing GPU task into CPU. (or I could just take every one of 30 data and send, but the user can zoom up the graph and it will be ugly.)

Instead, I could use QQuickPaintedItem and draw on the FrameBufferObject incrementally, but when the user drags the graph and the graph redraws, it will send one hundred thousand gl-calls in one frame(or do it in CPU, but it will be slow anyways).

Which one is the faster way? or is there a better way to do this?

EDIT: I think I found a much better solution. I could split the data recursively and adaptively add the points until it gets smooth enough. This way I will be able to reduce the data to about 500 points, which is cheap enough to send to GPU every frame, while only accessing to the points needed in CPU. The only concern is whether g++ can optimize the recursive call for low overhead.

eivour
  • 1,678
  • 12
  • 20
  • Hi, Could you please guide me for a similar kind of implementation (specifically for an ecg graph drawing.), I have been searching for it for quite some time. Do you have some good examples of using Qt Scene Graph for such use cases or does your source code available open source? Thanks – Nikhil Augustine Sep 20 '18 at 09:45

0 Answers0