1 #ifndef BLANK_GRAPHICS_TEXTUREBASE_HPP_
2 #define BLANK_GRAPHICS_TEXTUREBASE_HPP_
9 template<GLenum TARGET, GLsizei COUNT = 1>
16 TextureBase(TextureBase &&other) noexcept;
17 TextureBase &operator =(TextureBase &&) noexcept;
19 TextureBase(const TextureBase &) = delete;
20 TextureBase &operator =(const TextureBase &) = delete;
23 void Bind(GLsizei which = 0) noexcept {
24 glBindTexture(TARGET, handle[which]);
27 void FilterNearest() noexcept {
28 glTexParameteri(TARGET, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
29 glTexParameteri(TARGET, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
31 void FilterLinear() noexcept {
32 glTexParameteri(TARGET, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
33 glTexParameteri(TARGET, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
35 void FilterTrilinear() noexcept {
36 glTexParameteri(TARGET, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
37 glTexParameteri(TARGET, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);
38 glGenerateMipmap(TARGET);
41 void WrapEdge() noexcept {
42 glTexParameteri(TARGET, GL_TEXTURE_WRAP_R, GL_CLAMP_TO_EDGE);
43 glTexParameteri(TARGET, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
44 glTexParameteri(TARGET, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
46 void WrapBorder() noexcept {
47 glTexParameteri(TARGET, GL_TEXTURE_WRAP_R, GL_CLAMP_TO_BORDER);
48 glTexParameteri(TARGET, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_BORDER);
49 glTexParameteri(TARGET, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_BORDER);
51 void WrapRepeat() noexcept {
52 glTexParameteri(TARGET, GL_TEXTURE_WRAP_R, GL_REPEAT);
53 glTexParameteri(TARGET, GL_TEXTURE_WRAP_S, GL_REPEAT);
54 glTexParameteri(TARGET, GL_TEXTURE_WRAP_T, GL_REPEAT);
56 void WrapMirror() noexcept {
57 glTexParameteri(TARGET, GL_TEXTURE_WRAP_R, GL_MIRRORED_REPEAT);
58 glTexParameteri(TARGET, GL_TEXTURE_WRAP_S, GL_MIRRORED_REPEAT);
59 glTexParameteri(TARGET, GL_TEXTURE_WRAP_T, GL_MIRRORED_REPEAT);