Vis 2 Demo  1.0
Technical illustration type real-time rendering of geometry
 All Classes Namespaces Files Functions Variables Typedefs Macros
Texture.h
Go to the documentation of this file.
1 #ifndef __VIS2_TEXTURE_H__
2 #define __VIS2_TEXTURE_H__
3 
4 #include <string>
5 #include <glew.h>
6 #include "DevIL/IL/il.h"
7 
8 #define VIS2_TEX_TYPE_RGB 0
9 #define VIS2_TEX_TYPE_RGBA 1
10 #define VIS2_TEX_TYPE_DEPTH 2
11 
12 namespace vis2
13 {
15 
19  class Texture
20  {
21  public:
24 
26 
30  Texture(const std::string& _str_path);
31 
33 
38  Texture(const unsigned int _width, const unsigned int _height, const unsigned int _type);
39 
41  ~Texture();
42 
44  void textureBind(const int _unit);
45 
47 
50  void textureBind2FBO(const int _unit);
51 
53 
54  inline unsigned int getTextureType() const {return texture_type;}
56 
57  inline unsigned int getTextureWidth() const {return texture_width;}
59 
60  inline unsigned int getTextureHeight() const {return texture_height;}
61 
63  static void initDevIL();
64 
65  private:
66  // DevIL vars
68 
69  // OpenGL vars
70  GLuint texture_handle;
71  unsigned int texture_type;
72  unsigned int texture_width;
73  unsigned int texture_height;
74 
76 
79  void loadTextureFromFile(const std::string _file_path);
80 
82  Texture(const Texture&);
83  };
84 }
85 
86 #endif