#ifndef GLWIDGET_H #define GLWIDGET_H #include "../Common/GCycleQueue.h" #include #include #include #include typedef unsigned char BYTE, Byte, byte; enum GLBackgorundImgType { Normal, //普通高德背景 // ConnectionNotEstablished, //光纤物理链路不通 (读CAPTURE_PORT_STATUS寄存器) WrongImgSize, //FPGA收到的图像数据大小与设置的图像大小不一致 (读CAPTURE_PORT_STATUS寄存器) NoInterEvent, //读中断事件一直为0 中断线程状态 无数据 ChannelFailLink,//通道link失败 ChannelFailEncode, //8B / 10B编码错误 FailLinkAndFailEncode, //通道link失败 + 8B / 10B编码错误 }; class GLWidget : public QOpenGLWidget, protected QOpenGLFunctions { Q_OBJECT public: explicit GLWidget(QWidget* parent = nullptr); ~GLWidget(); void SetStatusBackImg(GLBackgorundImgType type); void Init(int iWidth, int iHeight); bool UpdateImageData(byte* pFrameData); protected: void initializeGL() override; void paintGL() override; void resizeGL(int width, int height) override; // void mousePressEvent(QMouseEvent* event) override; public slots: void setTextureImage(const QImage& image); public slots: void OnTimer_UpdataVideoView(); private: QOpenGLTexture* texture; QImage m_varBackImg; QImage m_varImage; QTimer m_varTimer; bool m_bStartNewImg; bool m_bIsOpenGLInit; GCycleQueue m_varDataQueue; int m_iWidth; int m_iHeight; }; #endif // GLWidget_H