ShaderRect.h 697 B

12345678910111213141516171819202122232425262728293031323334
  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. void drawShape() override;
  17. /* 刷新一帧 */
  18. bool refreshFrameRGBA(const QImage& image, int textureUnit = 0);
  19. private:
  20. GLuint m_VAO = 0; // 顶点数组对象的ID
  21. GLuint m_VBO = 0; // 顶点缓冲对象的ID
  22. GLuint m_EBO = 0; // 索引缓冲对象的ID
  23. QSize m_lastSize; /* 上一张图片的大小 */
  24. };
  25. #endif // SHADERRECT_H