1 #ifndef BLOBS_GRAPHICS_TEXTUREBASE_HPP_
2 #define BLOBS_GRAPHICS_TEXTUREBASE_HPP_
10 template<GLenum TARGET, GLsizei COUNT = 1>
17 TextureBase(TextureBase &&other) noexcept;
18 TextureBase &operator =(TextureBase &&) noexcept;
20 TextureBase(const TextureBase &) = delete;
21 TextureBase &operator =(const TextureBase &) = delete;
24 void Bind(GLsizei which = 0) noexcept {
25 glBindTexture(TARGET, handle[which]);
28 void FilterNearest() noexcept {
29 glTexParameteri(TARGET, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
30 glTexParameteri(TARGET, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
32 void FilterLinear() noexcept {
33 glTexParameteri(TARGET, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
34 glTexParameteri(TARGET, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
36 void FilterTrilinear() noexcept {
37 glTexParameteri(TARGET, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
38 glTexParameteri(TARGET, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);
39 glGenerateMipmap(TARGET);
42 void WrapEdge() noexcept {
43 glTexParameteri(TARGET, GL_TEXTURE_WRAP_R, GL_CLAMP_TO_EDGE);
44 glTexParameteri(TARGET, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
45 glTexParameteri(TARGET, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
47 void WrapBorder() noexcept {
48 glTexParameteri(TARGET, GL_TEXTURE_WRAP_R, GL_CLAMP_TO_BORDER);
49 glTexParameteri(TARGET, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_BORDER);
50 glTexParameteri(TARGET, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_BORDER);
52 void WrapRepeat() noexcept {
53 glTexParameteri(TARGET, GL_TEXTURE_WRAP_R, GL_REPEAT);
54 glTexParameteri(TARGET, GL_TEXTURE_WRAP_S, GL_REPEAT);
55 glTexParameteri(TARGET, GL_TEXTURE_WRAP_T, GL_REPEAT);
57 void WrapMirror() noexcept {
58 glTexParameteri(TARGET, GL_TEXTURE_WRAP_R, GL_MIRRORED_REPEAT);
59 glTexParameteri(TARGET, GL_TEXTURE_WRAP_S, GL_MIRRORED_REPEAT);
60 glTexParameteri(TARGET, GL_TEXTURE_WRAP_T, GL_MIRRORED_REPEAT);