#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 enum { Left_Bottom_X, Left_Bottom_Y, Right_Bottom_X, Right_Bottom_Y, Right_Top_X, Right_Top_Y, Left_Top_X, Left_Top_Y, Pos_Max }; public: explicit PlayerGLWidget(QWidget *parent = nullptr); ~PlayerGLWidget(); /* 刷新一帧 */ 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; // void setImage(const QImage &image); private: Image_QImage m_image; Image_YUV420 m_YUV420; QByteArray yData; QByteArray uData; QByteArray vData; QOpenGLTexture* textureY_; QOpenGLTexture* textureU_; QOpenGLTexture* textureV_; GLuint textureIdY_; GLuint textureIdU_; GLuint textureIdV_; QSize Ortho2DSize_; QSize imageSize_; // 添加此行 GLuint shaderProgram; // 添加此行 GLuint VAO, VBO, EBO; // 添加此行 }; #endif /* PLAYEROPENGLWIDGET_H */