#ifndef PLAYEROPENGLWIDGET_H #define PLAYEROPENGLWIDGET_H #include #include #include #include #include #include "PlayerGlobalInfo.h" class PlayerGLWidget : public QOpenGLWidget , public QOpenGLFunctions { Q_OBJECT public: explicit PlayerGLWidget(QWidget *parent = nullptr); ~PlayerGLWidget(); /* 刷新一帧 */ void updateFrame(Image_YUV420& image); public slots: void updateYUVData(const QByteArray &y, const QByteArray &u, const QByteArray &v) { yData = y; uData = u; vData = v; update(); } private: void initShaders(); void initTextures(); void initVertex(); void initFrameBuffer(); void renderYUV420P(); protected: void initializeGL() override; void resizeGL(int w, int h) override; void paintGL() override; private: QOpenGLShaderProgram program; QOpenGLTexture *textureY = nullptr; QOpenGLTexture *textureU = nullptr; QOpenGLTexture *textureV = nullptr; QByteArray yData; QByteArray uData; QByteArray vData; }; #endif /* PLAYEROPENGLWIDGET_H */