3 This file is part of libmspgl
4 Copyright © 2007 Mikko Rasa, Mikkosoft Productions
5 Distributed under the LGPL
8 #ifndef MSP_GL_TEXTURE2D_H_
9 #define MSP_GL_TEXTURE2D_H_
12 #include <msp/gbase/image.h>
14 #include "pixelformat.h"
21 Two-dimensional texture class. This is the most common type of texture.
23 class Texture2D: public Texture
26 class Loader: public Texture::Loader
31 void image_data(const std::string &);
32 void raw_data(const std::string &);
33 void storage(PixelFormat, unsigned, unsigned, unsigned);
46 Defines the texture storage. This function may only be successfully called
49 void storage(PixelFormat fmt, unsigned wd, unsigned ht, int brd);
52 Uploads an image to the texture. storage() must have been called prior to
53 this, and the image must have dimensions conforming to the specified
56 void image(int level, PixelFormat fmt, DataType type, const void *data);
59 Uploads a sub-image into the texture. Unlike full image upload, there are
60 no constraints on the size of the sub-image.
62 void sub_image(int level, int x, int y, unsigned wd, unsigned ht, PixelFormat fmt, DataType type, const void *data);
65 Loads an image from a file and uploads it to the texture. If storage() has
66 not been called, the storage format will be set to match the loaded image.
68 void load_image(const std::string &fn);
70 unsigned get_width() const { return width; }
71 unsigned get_height() const { return height; }
74 void image(const Graphics::Image &);