Texture.h 857 B

123456789101112131415161718192021222324252627282930313233343536373839
  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. template<int N>
  9. friend class Framebuffer;
  10. public:
  11. Texture(const TextureFormat& format);
  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 setFormat(const TextureFormat& format);
  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 setFilter(GLint param);
  27. void setWrap(GLint param);
  28. void bind() const;
  29. };
  30. #endif