Texture.h 860 B

12345678910111213141516171819202122232425262728293031323334353637
  1. #ifndef TEXTURE_H
  2. #define TEXTURE_H
  3. #include "rendering/TextureFormat.h"
  4. #include "wrapper/GL.h"
  5. class Texture final {
  6. TextureFormat format;
  7. GL::Texture texture;
  8. int maxMipMaps;
  9. template<int N>
  10. friend class Framebuffer;
  11. public:
  12. Texture(const TextureFormat& format, int maxMipMaps = 0);
  13. Texture(int maxMipMaps = 0);
  14. ~Texture();
  15. Texture(const Texture& other) = delete;
  16. Texture(Texture&& other) = delete;
  17. Texture& operator=(const Texture& other) = delete;
  18. Texture& operator=(Texture&& other) = delete;
  19. void setFormat(const TextureFormat& format);
  20. void setNearestFilter();
  21. void setLinearFilter();
  22. void setRepeatWrap();
  23. void setClampWrap();
  24. void setData(int width, int height, const void* data = nullptr);
  25. void bindTo(int index = 0) const;
  26. private:
  27. void bind() const;
  28. };
  29. #endif