3 This file is part of libmspgl
4 Copyright © 2007 Mikko Rasa, Mikkosoft Productions
5 Distributed under the LGPL
8 #ifndef MSP_GL_TEXTURE_H_
9 #define MSP_GL_TEXTURE_H_
12 #include <msp/datafile/objectloader.h>
14 #include "predicate.h"
23 NEAREST_MIPMAP_NEAREST = GL_NEAREST_MIPMAP_NEAREST,
24 NEAREST_MIPMAP_LINEAR = GL_NEAREST_MIPMAP_LINEAR,
25 LINEAR_MIPMAP_NEAREST = GL_LINEAR_MIPMAP_NEAREST,
26 LINEAR_MIPMAP_LINEAR = GL_LINEAR_MIPMAP_LINEAR
29 std::istream &operator>>(std::istream &, TextureFilter &);
35 CLAMP_TO_EDGE = GL_CLAMP_TO_EDGE,
36 CLAMP_TO_BORDER = GL_CLAMP_TO_BORDER,
37 MIRRORED_REPEAT = GL_MIRRORED_REPEAT
42 Base class for textures. This class only defines operations common for all
43 texture types and is not instantiable. For specifying images for textures, see
44 one of the dimensioned texture classes.
49 class Loader: public DataFile::ObjectLoader<Texture>
53 void min_filter(TextureFilter);
54 void mag_filter(TextureFilter);
55 void generate_mipmap(bool);
72 TextureFilter min_filter;
73 TextureFilter mag_filter;
80 mutable int dirty_params;
83 Texture(const Texture &);
84 Texture &operator=(const Texture &);
89 void update_parameter(int) const;
91 void set_min_filter(TextureFilter);
92 void set_mag_filter(TextureFilter);
93 void set_wrap(TextureWrap);
94 void set_wrap_s(TextureWrap);
95 void set_wrap_t(TextureWrap);
96 void set_wrap_r(TextureWrap);
97 void set_generate_mipmap(bool);
98 void set_compare_enabled(bool);
99 void set_compare_func(Predicate);
100 GLenum get_target() const { return target; }
101 unsigned get_id() const { return id; }
104 void bind_to(unsigned) const;
106 static const Texture *current();
107 static void unbind();
108 static void unbind_from(unsigned);