For this kind of work I'd recoment QNanoPainter, it's another Qt paint engine built on top of modern openGL, very efficient for what you want (polylines) : https://github.com/QUItCoding/qnanopainter
Best, ------- Jean-Michaël Celerier http://www.jcelerier.name On Sun, Sep 2, 2018 at 2:45 PM Uwe Rathmann <uwe.rathm...@tigertal.de> wrote: > On Thu, 30 Aug 2018 15:47:34 -0700, Thiago Macieira wrote: > > > You can always just use QPainter on a QPixmap and paint that pixmap on > > your QSGPaintedItem. It won't be particularly fast, but it will work and > > do what you asked. > > After some conversation with Denis: the use case of this thread is a > oscilloscope - drawing a polyline with ~400 points, 10 times a second. > > It is possible to reduce the CPU load from 100% to 50% simply by using a > QOpenGLWidget as plot canvas. With raster we probably never reached 10 > frames, so all we know is that the improvement is more than by factor 2. > > The rest seems to be related to the grid lines, and updating the tick > labels on the axis. > > Updating the tick labels 10 times a second does not make much sense as > nobody can read this. So I would consider this being an issue, that has > to be solved on application side. > > But the grid lines are responsible for ~30% of the remaining CPU load, so > let's spend some thoughts on this: > > drawing them requires a sequence of QPainter::drawLine calls ( maybe > 10-20 ) with a pen width of 1 in Qt::DotLine style. Changing the style to > Qt::SolidLine makes this part of the CPU load disappear - actually the > CPU load becomes the same as when not drawing the grid at all. > > So I would guess that the CPU cycles are related to calculating the dots > for each line before forwarding it to some OpenGL call. > > > If you want faster, redesign with OpenGL in mind. > > What does that mean for a task like drawing a dotted line and why do you > consider application code being more effective in finding a fast > implementation for this ? > > I would expect the author/maintainer of the OpenGL paint engine being an > expert in how to use OpenGL in the most effective way and the job of this > module should be to keep away those details from the application code. > > And what would be the benefit of Qt/Quick for drawing dotted lines ? How > would it be different/superior compared to writing pure OpenGL code - f.e > in QOpenGLWidget::paintGL ? > > And why should Denis use Qt at all if he is supposed to break down basic > primitives to pure OpenGL himself ? > > Uwe > > > _______________________________________________ > Development mailing list > Development@qt-project.org > http://lists.qt-project.org/mailman/listinfo/development >
_______________________________________________ Development mailing list Development@qt-project.org http://lists.qt-project.org/mailman/listinfo/development