QOpenGLWidgewt DirectRendering
-
He at all .... I update my app from qt4.8 to QT5.12 .... QGLWidget I discover is obsolete so I must use QOpenGLWidget instead.
These is ok, but in my old code I can subcalss QGLWidget and make a direct rendering type ... now seems not possible .... these the first function of my subclass of QOpenGLWidget (is the same class of QOpenGLWidget but I add some custom function fr open and close a camera)
GLwidg::GLwidg(QWidget *parent) : QOpenGLWidget(parent) { this->setAttribute(Qt::WA_DeleteOnClose); // //QOpenGLWidget(QOpenGLFormat(Qt::DirectRendering)); /* these attribute not exist and not fins a substitute*/ setMaximumSize(480, 360);//(352,288); setMinimumSize(480, 360); setBaseSize(480, 360); }
All work but my widget show a webcam grab with opencv4.4. In test window of opencv I see the video with correct fps (40/50 more or less), in my app on QOpenGLWidget i see the same but at 0.1fps.
In the old 4.8 with Qt::DirectRendering all work like a charm .... with 5.12 no.
what's wrong?
regards
-
Hi
https://forum.qt.io/topic/45653/qsurfaceformat-vs-qglformat-resolvedit seems that one can use QSurfaceFormat instead of QOpenGLFormat
-
QSurfaceFormat is not for rendering type .... but reading the istructions for that class I see it use "update()" function .... so because QSurfaceFormat is part of QOpenGLWidget I cancel all my "makecurrent()" call on my code and I use "update()" instead. Plus I leave from my subclass of QOpenGLWIdget resizeGL() and inizializeGL() private functions because really not utilize .... QOpenGLWidget automatize all these things.
Any how after substitutions of all "makecurrent()" call with "update()" call my videostream on qt GUI become working. But for some reasons original video sending from opencv based thread work perfect (i can see it because from opencv thread I can call a video QT windows that show me these) , butevery now and then QOpenGLWidget shows me a 16 split screen with the video converted to the wrong colorspace. This just for a moment, then it resumes normal video and you can again in small strokes, as if a buffer is overloaded and wants to get noticed ....
regards