#ifndef PLAYEROPENGLWIDGET_H #define PLAYEROPENGLWIDGET_H #include // #include // 添加此行 #include // 添加此行 #include #include "PlayerGlobalInfo.h" /** * @brief * */ class PlayerGLWidget : public QOpenGLWidget, protected QOpenGLFunctions_3_3_Core // 修改此行 { Q_OBJECT public: explicit PlayerGLWidget(QWidget *parent = nullptr); ~PlayerGLWidget(); /* 设置一张图片,用于显示默认的图片 */ void setImage(const QImage& image); /* 刷新一帧 */ void updateFrame(Image_YUV420& image); /* 刷新一帧QImage */ void updateFrame(Image_QImage& image); private: /* 转换成YUV420 */ void convertQImageToYUV420(const QImage& image, Image_YUV420& yuv420); protected: void initializeGL() override; void resizeGL(int w, int h) override; void paintGL() override; private: Image_QImage m_image; Image_YUV420 m_YUV420; QByteArray m_yData; QByteArray m_uData; QByteArray m_vData; QSize m_imageSize; QOpenGLTexture* textureY_; QOpenGLTexture* textureU_; QOpenGLTexture* textureV_; GLuint textureIdY_; GLuint textureIdU_; GLuint textureIdV_; QSize Ortho2DSize_; GLuint shaderProgram; GLuint VAO, VBO, EBO; }; #endif /* PLAYEROPENGLWIDGET_H */