ShaderRect.h 837 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. #ifndef SHADERRECT_H
  2. #define SHADERRECT_H
  3. #include "ShaderBase.h"
  4. /**
  5. * @brief 显示矩形RGBA图片
  6. *
  7. */
  8. class ShaderRect : public ShaderBase
  9. {
  10. public:
  11. ShaderRect();
  12. ~ShaderRect();
  13. /* 初始化形状 */
  14. GLuint initShape() override;
  15. /* 初始化纹理对象 */
  16. bool initTextures() override;
  17. /* 绘制图形 */
  18. void drawShape() override;
  19. /* 刷新一帧 */
  20. bool refreshFrameRGBA(const QImage& image, int textureUnit = 0);
  21. private:
  22. GLuint m_VAO = 0; // 顶点数组对象的ID
  23. GLuint m_VBO = 0; // 顶点缓冲对象的ID
  24. GLuint m_EBO = 0; // 索引缓冲对象的ID
  25. QSize m_lastSize; /* 上一张图片的大小 */
  26. const QString m_textureRGBAName = "textureRGBA"; // RGBA纹理名称
  27. };
  28. #endif // SHADERRECT_H