Re: QOpenGLWidget
Thomas Caswell <[email protected]>
| Newsgroups | gmane.comp.python.pyqt-pykde |
|---|---|
| Message-ID | <CAA48SF_cYnsXVnR9C++ViuGTS+AV+k6BDmv6jSQbTbgYmYcz7Q@mail.gmail.com> |
You should also look at pyqtgraph (http://www.pyqtgraph.org) which places a premium on speed. Depending on exactly how much data you have and exactly how fast you need to go, using blitting it Matplotlib it may be possible to eek out a bit more performance. Tom On Sun, Sep 22, 2019 at 8:03 PM V. Armando Sole <[email protected]> wrote: > Hello, > > Perhaps you want to give a try at the silx library > (http://www.silx.org/doc/silx/latest/). I provides high-level PyQt > visualization widgets with a dual backend (matplotlib and PyOpenGL) so > that one does not need to know any OpenGL to get the performance. > > Best regards, > > Armando > > On 22.09.2019 17:07, [email protected] wrote: > > Hi, > > > > I'm building an application in PyQt5 for which I need to draw 2D live > > graphs. I'm looking for a way to render them with the GPU. > > > > 1. FIRST APPROACH > > > > --------------------- > > > > My first approach was embedding matplotlib into PyQt5. Matplotlib is > > not so fast, because _it relies on CPU-rendering only_. > > > > 2. SECOND APPROACH > > > > ------------------------ > > > > I build my own PyQt5 widget and override the paintEvent() method to > > draw a few thousand lines with the QPainter() to display the live > > graph. The graph points are stored in numpy arrays. I simply draw > > lines between the points. Unfortunately, QPainter() relies on the > > CPU. > > > > Right now, it looks like I have several options for GPU-based > > rendering: > > > > - QOPENGLWIDGET > > (see https://doc.qt.io/qt-5/qopenglwidget.html). From what I read on > > the Qt docs, it looks too good to be true. I would simply need to > > subclass QOpenGLWidget instead of QWidget. Apparently, I eveb don't > > have to change anything in the paintEvent() method. Is this real? > > Where are the pitfalls? > > > > - PYOPENGL > > Python bindings for OpenGL. I have no OpenGL experience. I found the > > following tutorial: https://www.labri.fr/perso/nrougier/python-opengl/ > > . Great, but I'm afraid to spend a lot of time on this. When I scroll > > through the tutorial, it appears to me that the focus is on 3D shapes. > > I don't need that. > > > > - QGRAPHICSVIEW > > > > I remember reading something about QGraphicsView() in a StackOverflow > > answer. It would be a Qt class to draw lots of shapes. But can it > > handle thousands of tiny lines that form the live graph? Does it rely > > on the CPU or the GPU for rendering? > > > > Could you point me in the right direction please? > > _______________________________________________ > > PyQt mailing list [email protected] > > https://www.riverbankcomputing.com/mailman/listinfo/pyqt > _______________________________________________ > PyQt mailing list [email protected] > https://www.riverbankcomputing.com/mailman/listinfo/pyqt > -- Thomas Caswell [email protected] _______________________________________________ PyQt mailing list [email protected] https://www.riverbankcomputing.com/mailman/listinfo/pyqt