Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt
  • Unsolved
Collapse
qtws26_logo

The Qt Event of the Year: Qt World Summit 2026

Save Your Spot >
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QOpenGLWidgewt DirectRendering
Qt 6.12 LTS is out! See what's new in the release blog

QOpenGLWidgewt DirectRendering

Scheduled Pinned Locked Moved General and Desktop
3 Posts 2 Posters 662 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • gfxxG Offline
    gfxxG Offline
    gfxx
    wrote on last edited by gfxx
    #1

    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

    bkt

    1 Reply Last reply
    0
    • mrjjM Offline
      mrjjM Offline
      mrjj
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi
      https://forum.qt.io/topic/45653/qsurfaceformat-vs-qglformat-resolved

      it seems that one can use QSurfaceFormat instead of QOpenGLFormat

      1 Reply Last reply
      1
      • gfxxG Offline
        gfxxG Offline
        gfxx
        wrote on last edited by gfxx
        #3

        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

        bkt

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt
        • Unsolved