bloboland
view src/texture.h @ 5:2f4406cc341e
meh
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Wed, 19 Dec 2012 02:37:20 +0200 |
parents | 9021a906c5d3 |
children |
line source
1 #ifndef TEXTURE_H_
2 #define TEXTURE_H_
4 class Texture {
5 protected:
6 unsigned int type;
7 unsigned int tex;
8 unsigned int intfmt;
10 int size[3];
12 public:
13 Texture();
14 virtual ~Texture();
16 virtual void set_pixel_format(unsigned int fmt);
18 virtual void set_filtering(unsigned int min_filter, unsigned int mag_filter = 0);
19 virtual void set_wrapping(unsigned int wrap);
21 virtual int get_size(int idx) const;
23 virtual void update(float *data) = 0;
25 friend void bind_texture(const Texture *tex, int texunit);
26 };
28 void bind_texture(const Texture *tex, int texunit = 0);
30 class Texture1D : public Texture {
31 public:
32 Texture1D();
34 void create(int sz, float *data = 0);
36 void update(float *data);
37 };
39 class Texture2D : public Texture {
40 public:
41 Texture2D();
43 void create(int xsz, int ysz, float *data = 0);
45 void update(float *data);
46 };
48 class Texture3D : public Texture {
49 public:
50 Texture3D();
52 void create(int xsz, int ysz, int zsz, float *data = 0);
54 void update(float *data);
55 };
57 #endif // TEXTURE_H_