Texture.hpp
Go to the documentation of this file.
1 
6 #pragma once
7 
8 #include <etk/types.hpp>
9 #include <ewol/debug.hpp>
10 #include <egami/Image.hpp>
11 #include <gale/resource/Texture.hpp>
12 
13 namespace ewol {
14  namespace resource {
15  class Texture : public gale::Resource {
16  protected:
17  uint32_t m_texId;
18  // openGl Context propoerties :
19  egami::Image m_data;
20  // some image are not square == > we need to sqared it to prevent some openGl api error the the displayable size is not all the time 0.0 -> 1.0
21  vec2 m_endPointSize;
22  // internal state of the openGl system :
23  bool m_loaded;
24  // Public API:
25  protected:
26  void init(const std::string& _filename);
27  void init();
28  Texture();
29  public:
30  DECLARE_RESOURCE_FACTORY(Texture);
31  virtual ~Texture();
32  public:
33  // you must set the size here, because it will be set in multiple of pow(2)
34  void setImageSize(ivec2 newSize);
35  // get the reference on this image to draw nomething on it ...
36  inline egami::Image& get() {
37  return m_data;
38  };
39  // flush the data to send it at the openGl system
40  void flush();
41  bool updateContext();
42  void removeContext();
43  void removeContextToLate();
44  const ivec2& getOpenGlSize() const {
45  return m_data.getSize();
46  };
47  uint32_t getRendererId() const {
48  return m_texId;
49  };
50  };
51  }
52 }
53 
uint32_t m_texId
openGl textureID.
Definition: Texture.hpp:17
Definition: Area.hpp:16
Definition: Texture.hpp:15