Texture.h 807 B

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