TextureData.h
Go to the documentation of this file.
1 #ifndef B_TEXTURE_DATA_H
2 #define B_TEXTURE_DATA_H
3 
4 #include <memory>
5 #include <string>
6 #include "Renderer_GL.h"
7 
8 typedef std::shared_ptr< GLubyte > ImageDataPtr;
9 
14 {
15 public:
16 
17  /* Functions */
18 
22 
26  TextureData(const std::string &fileName);
27 
34  TextureData(GLsizei width, GLsizei height, GLenum format = GL_RGBA, ImageDataPtr imageData = nullptr);
35 
38  virtual ~TextureData() {}
39 
43  virtual TextureData &load(const std::string &fileName);
44 
51  virtual TextureData &create(GLsizei width, GLsizei height, GLenum format = GL_RGBA, ImageDataPtr imageData = nullptr);
52 
55  GLsizei getWidth() const { return _width; }
56 
59  GLsizei getHeight() const { return _height; }
60 
63  GLenum getFormat() const { return _format; }
64 
67  ImageDataPtr getImageData() const { return _imageData; }
68 
69 private:
70 
71  /* Variables */
72 
73  GLsizei _width;
74  GLsizei _height;
75  GLenum _format;
76  ImageDataPtr _imageData = nullptr;
77 };
78 
79 #endif /* defined(B_TEXTURE_DATA_H) */
virtual ~TextureData()
Virtual destructor.
Definition: TextureData.h:38
GLsizei getWidth() const
Gets the width of the texture.
Definition: TextureData.h:55
virtual TextureData & create(GLsizei width, GLsizei height, GLenum format=GL_RGBA, ImageDataPtr imageData=nullptr)
Creates a texture.
Definition: TextureData.cpp:14
virtual TextureData & load(const std::string &fileName)
Loads the texture from an image.
The underlying data of a texture.
Definition: TextureData.h:13
std::shared_ptr< GLubyte > ImageDataPtr
Definition: TextureData.h:8
ImageDataPtr getImageData() const
Gets the image data of the texture.
Definition: TextureData.h:67
GLsizei getHeight() const
Gets the height of the texture.
Definition: TextureData.h:59
TextureData()
Constructor.
Definition: TextureData.h:21
GLenum getFormat() const
Gets the format of the texture.
Definition: TextureData.h:63