1234567891011121314151617181920212223242526272829303132333435 |
- #ifndef TEXTURE_H
- #define TEXTURE_H
- #include <GL/glew.h>
- #include "gaming-core/utils/Color.h"
- class Texture final {
- GLuint texture;
- public:
- Texture();
- ~Texture();
- Texture(const Texture& other) = delete;
- Texture(Texture&& other) = delete;
- Texture& operator=(const Texture& other) = delete;
- Texture& operator=(Texture&& other) = delete;
- void setColorData(int width, int height, const Color4* data);
- void setColorData(int width, int height, const Color3* data);
- void setColorData(int width, int height, const Color2* data);
- void setColorData(int width, int height, const Color1* data);
- void bind() const;
- private:
- template<int N>
- void setColorData(int width, int height, int mode, const Color<N>* data) {
- glBindTexture(GL_TEXTURE_2D, texture);
- glTexImage2D(GL_TEXTURE_2D, 0, mode, width, height, 0, mode, GL_UNSIGNED_BYTE, data);
- }
- };
- #endif
|