Nymph Game Engine
Chaiscript based Game Engine
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
base_texture.h
Go to the documentation of this file.
1 #ifndef BASE_TEXTURE_H
2 #define BASE_TEXTURE_H
3 #include <memory>
4 #ifdef __APPLE__
5 #include <OpenGL/gl3.h>
6 #else
7 #include <GL/glew.h>
8 #endif
9 #include <string>
10 //= SCRIPTABLE
11 
12 namespace Graphics {
16  class BaseTexture {
17  private:
18  unsigned int texture_object;
19  GLenum texture_type;
20  bool loaded;
21  unsigned int width;
22  unsigned int height;
23  std::string name;
24  public:
25  BaseTexture() = delete;
26  //= BEGIN SCRIPTABLE
27 
33  BaseTexture(const GLenum texture_type);
37  ~BaseTexture();
38 
44  unsigned int getWidth() const noexcept;
50  unsigned int getHeight() const noexcept;
51 
59  virtual bool load(const std::string& filename);
65  virtual void bind(const unsigned int texture_unit);
71  virtual bool isLoaded() const noexcept;
72 
78  void setName(const std::string name) noexcept;
84  std::string getName() const noexcept;
85 
91  std::string to_string() const noexcept;
92  //= END SCRIPTABLE
93 
99  virtual unsigned int getTextureObject() const noexcept;
100  };
101 }
102 
103 #endif
virtual unsigned int getTextureObject() const noexcept
Gets the texture object.
Definition: base_texture.cpp:77
std::string getName() const noexcept
Gets the name.
Definition: base_texture.cpp:90
virtual bool load(const std::string &filename)
Loads the texture.
Definition: base_texture.cpp:24
~BaseTexture()
Destroys the object.
Definition: base_texture.cpp:12
unsigned int getHeight() const noexcept
Gets the height.
Definition: base_texture.cpp:20
Class for base texture.
Definition: base_texture.h:16
virtual void bind(const unsigned int texture_unit)
Binds texture to opengl on the texture unit.
Definition: base_texture.cpp:69
unsigned int getWidth() const noexcept
Gets the width.
Definition: base_texture.cpp:16
void setName(const std::string name) noexcept
Sets the name.
Definition: base_texture.cpp:86
std::string to_string() const noexcept
Returns a string representation of the object.
Definition: base_texture.cpp:94
virtual bool isLoaded() const noexcept
Determines if loaded.
Definition: base_texture.cpp:82