Texture.h 934 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. #ifndef TEXTURE_H
  2. #define TEXTURE_H
  3. #include <GL/glew.h>
  4. #include "wrapper/TextureFormat.h"
  5. class Texture final {
  6. TextureFormat format;
  7. GLuint 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 setFilter(GLint minParam, GLint maxParam);
  28. void setWrap(GLint param);
  29. void bind() const;
  30. };
  31. #endif