#ifndef SHADERRECT_H #define SHADERRECT_H #include "ShaderBase.h" /** * @brief 显示矩形RGBA图片 * */ class ShaderRect : public ShaderBase { public: ShaderRect(); ~ShaderRect(); /* 初始化形状 */ GLuint initShape() override; /* 初始化纹理对象 */ bool initTextures() override; /* 绘制图形 */ void drawShape() override; /* 刷新一帧 */ bool refreshFrameRGBA(const QImage& image, int textureUnit = 0); private: GLuint m_VAO = 0; // 顶点数组对象的ID GLuint m_VBO = 0; // 顶点缓冲对象的ID GLuint m_EBO = 0; // 索引缓冲对象的ID QSize m_lastSize; /* 上一张图片的大小 */ const QString m_textureRGBAName = "textureRGBA"; // RGBA纹理名称 }; #endif // SHADERRECT_H