Texture.h 792 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();
  13. ~Texture();
  14. Texture(const Texture& other) = delete;
  15. Texture(Texture&& other) = delete;
  16. Texture& operator=(const Texture& other) = delete;
  17. Texture& operator=(Texture&& other) = delete;
  18. void init(const TextureFormat& format, int maxMipMaps);
  19. void setNearestFilter();
  20. void setLinearFilter();
  21. void setRepeatWrap();
  22. void setClampWrap();
  23. void setData(int width, int height, const void* data = nullptr);
  24. void bindTo(int index = 0) const;
  25. private:
  26. void bind() const;
  27. };
  28. #endif