Texture.h 843 B

123456789101112131415161718192021222324252627282930313233343536373839
  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. Error load(const char* path, int maxMipMaps);
  26. private:
  27. void bind() const;
  28. };
  29. #endif