Rendering QImage on QGLWidget of QML plugin

后端 未结 2 809
情深已故
情深已故 2021-01-06 07:17

I\'m trying to write a QML plugin that reads frames from a video (using a custom widget to do that task, NOT QtMultimedia/Phonon), and each frame is convert

2条回答
  •  太阳男子
    2021-01-06 07:43

    I think that you have to draw on your glwidget using the opengl functions.

    One possible way is to override your paintGL() method in GLWidget and then draw your image with glDrawPixels().

    glClear(GL_COLOR_BUFFER_BIT);
    glDrawPixels(buffer.width(), buffer.height(), GL_RGBA, GL_UNSIGNED_BYTE, buffer.bits());
    

    Where buffer is a QImage object that needs to be converted using QGLWidget::converrtToGLFormat() static method.

    Look at this source for reference: https://github.com/nayyden/ZVector/blob/master/src/GLDebugBufferWidget.cpp

提交回复
热议问题