1 /*! 2 @file 3 @author George Evmenov 4 @date 07/2009 5 */ 6 7 #ifndef MYGUI_OPENGL3_TEXTURE_H_ 8 #define MYGUI_OPENGL3_TEXTURE_H_ 9 10 #include "MyGUI_Prerequest.h" 11 #include "MyGUI_ITexture.h" 12 #include "MyGUI_RenderFormat.h" 13 #include "MyGUI_OpenGL3ImageLoader.h" 14 15 namespace MyGUI 16 { 17 18 class OpenGL3RTTexture; 19 20 class OpenGL3Texture : public ITexture 21 { 22 public: 23 OpenGL3Texture(const std::string& _name, OpenGL3ImageLoader* _loader); 24 virtual ~OpenGL3Texture(); 25 26 virtual const std::string& getName() const; 27 28 virtual void createManual(int _width, int _height, TextureUsage _usage, PixelFormat _format); 29 virtual void loadFromFile(const std::string& _filename); 30 virtual void saveToFile(const std::string& _filename); 31 32 virtual void destroy(); 33 34 virtual int getWidth(); 35 virtual int getHeight(); 36 37 virtual void* lock(TextureUsage _access); 38 virtual void unlock(); 39 virtual bool isLocked(); 40 41 virtual PixelFormat getFormat(); 42 virtual TextureUsage getUsage(); 43 virtual size_t getNumElemBytes(); 44 45 virtual IRenderTarget* getRenderTarget(); 46 47 /*internal:*/ 48 unsigned int getTextureID() const; 49 void setUsage(TextureUsage _usage); 50 void createManual(int _width, int _height, TextureUsage _usage, PixelFormat _format, void* _data); 51 52 private: 53 void _create(); 54 55 private: 56 std::string mName; 57 int mWidth; 58 int mHeight; 59 int mPixelFormat; 60 int mInternalPixelFormat; 61 int mUsage; 62 int mAccess; 63 size_t mNumElemBytes; 64 size_t mDataSize; 65 unsigned int mTextureID; 66 unsigned int mPboID; 67 bool mLock; 68 void* mBuffer; 69 PixelFormat mOriginalFormat; 70 TextureUsage mOriginalUsage; 71 OpenGL3ImageLoader* mImageLoader; 72 OpenGL3RTTexture* mRenderTarget; 73 }; 74 75 } // namespace MyGUI 76 77 #endif // MYGUI_OPENGL3_TEXTURE_H_ 78