]> git.tdb.fi Git - libs/gl.git/blob - source/core/texture1d.h
Remove the separate allocation step from textures and buffers
[libs/gl.git] / source / core / texture1d.h
1 #ifndef MSP_GL_TEXTURE1D_H_
2 #define MSP_GL_TEXTURE1D_H_
3
4 #include "texture.h"
5
6 namespace Msp {
7 namespace GL {
8
9 class Texture1D: public Texture
10 {
11 public:
12         class Loader: public DataFile::DerivedObjectLoader<Texture1D, Texture::Loader>
13         {
14         public:
15                 Loader(Texture1D &);
16                 Loader(Texture1D &, Collection &);
17         private:
18                 void init();
19
20                 void raw_data(const std::string &);
21                 void storage(PixelFormat, unsigned);
22                 void storage_levels(PixelFormat, unsigned, unsigned);
23         };
24
25 private:
26         unsigned width;
27         unsigned levels;
28
29 public:
30         Texture1D();
31
32         void storage(PixelFormat, unsigned, unsigned = 0);
33
34         void image(unsigned, const void *);
35         void sub_image(unsigned, int, unsigned, const void *);
36         virtual void image(const Graphics::Image &, unsigned = 0);
37         using Texture::image;
38         unsigned get_width() const { return width; }
39
40 private:
41         unsigned get_n_levels() const;
42         unsigned get_level_size(unsigned) const;
43
44 public:
45         virtual AsyncLoader *load(IO::Seekable &, const Resources * = 0) { return 0; }
46         virtual std::uint64_t get_data_size() const;
47         virtual void unload() { }
48 };
49
50 } // namespace GL
51 } // namespace Msp
52
53 #endif