123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354 |
- #ifndef PLAYEROPENGLWIDGET_H
- #define PLAYEROPENGLWIDGET_H
- #include <QOpenGLWidget>
- #include <QOpenGLFunctions>
- #include <QOpenGLShaderProgram>
- #include <QOpenGLTexture>
- #include <QTimer>
- #include "PlayerGlobalInfo.h"
- class PlayerGLWidget : public QOpenGLWidget , public QOpenGLFunctions
- {
- Q_OBJECT
- public:
- explicit PlayerGLWidget(QWidget *parent = nullptr);
- ~PlayerGLWidget();
- /* 刷新一帧 */
- void updateFrame(Image_YUV420& image);
- 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;
- int width = 0;
- int height = 0;
- };
- #endif /* PLAYEROPENGLWIDGET_H */
|