GLImage.hh 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. #ifndef GLTEXTURE_HH
  2. #define GLTEXTURE_HH
  3. #include "BaseImage.hh"
  4. #include "GLUtil.hh"
  5. #include <cstdint>
  6. #include <string>
  7. class SDLSurfacePtr;
  8. namespace openmsx {
  9. class GLImage final : public BaseImage
  10. {
  11. public:
  12. GLImage(OutputSurface& output, const std::string& filename);
  13. GLImage(OutputSurface& output, SDLSurfacePtr image);
  14. GLImage(OutputSurface& output, const std::string& filename, float scaleFactor);
  15. GLImage(OutputSurface& output, const std::string& filename, gl::ivec2 size);
  16. GLImage(OutputSurface& output, gl::ivec2 size, unsigned rgba);
  17. GLImage(OutputSurface& output, gl::ivec2 size, const unsigned* rgba,
  18. int borderSize, unsigned borderRGBA);
  19. void draw(OutputSurface& output, gl::ivec2 pos,
  20. uint8_t r, uint8_t g, uint8_t b, uint8_t alpha) override;
  21. private:
  22. void initBuffers();
  23. gl::VertexArray vao;
  24. gl::BufferObject vbo[3];
  25. gl::BufferObject elementsBuffer;
  26. gl::Texture texture; // must come after size
  27. int borderSize;
  28. int bgA[4], borderA;
  29. uint8_t bgR[4], bgG[4], bgB[4];
  30. uint8_t borderR, borderG, borderB;
  31. };
  32. } // namespace openmsx
  33. #endif