diff options
author | Andrei Karas <akaras@inbox.ru> | 2014-06-04 23:57:06 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2014-06-04 23:57:06 +0300 |
commit | c0c3782473479460273f1d6e8e0e3e7564ecff89 (patch) | |
tree | a955e6376aa7c41d7bed3b60fd5b532fec5a7d20 /src/resources/openglimagehelper.h | |
parent | 0c72851a2b47acba27944106eea4619b658d40ca (diff) | |
download | manaverse-c0c3782473479460273f1d6e8e0e3e7564ecff89.tar.gz manaverse-c0c3782473479460273f1d6e8e0e3e7564ecff89.tar.bz2 manaverse-c0c3782473479460273f1d6e8e0e3e7564ecff89.tar.xz manaverse-c0c3782473479460273f1d6e8e0e3e7564ecff89.zip |
Create empty OpenGL textures in batches.
Diffstat (limited to 'src/resources/openglimagehelper.h')
-rw-r--r-- | src/resources/openglimagehelper.h | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/src/resources/openglimagehelper.h b/src/resources/openglimagehelper.h index 2f203a00a..d87052592 100644 --- a/src/resources/openglimagehelper.h +++ b/src/resources/openglimagehelper.h @@ -58,14 +58,14 @@ class OpenGLImageHelper final : public ImageHelper friend class Image; public: - OpenGLImageHelper() + OpenGLImageHelper() : + mFreeTextureIndex(0) { } A_DELETE_COPY(OpenGLImageHelper) - ~OpenGLImageHelper() - { } + ~OpenGLImageHelper(); /** * Loads an image from an SDL_RWops structure and recolors it. @@ -77,18 +77,18 @@ class OpenGLImageHelper final : public ImageHelper * otherwise. */ Image *load(SDL_RWops *const rw, - Dye const &dye) const override final A_WARN_UNUSED; + Dye const &dye) override final A_WARN_UNUSED; /** * Loads an image from an SDL surface. */ - Image *load(SDL_Surface *const tmpImage) const + Image *load(SDL_Surface *const tmpImage) override final A_WARN_UNUSED; Image *createTextSurface(SDL_Surface *const tmpImage, const int width, const int height, const float alpha) - const override final A_WARN_UNUSED; + override final A_WARN_UNUSED; // OpenGL only public functions @@ -119,6 +119,8 @@ class OpenGLImageHelper final : public ImageHelper SDL_Surface *create32BitSurface(int width, int height) const override final; + void postInit() override final; + protected: /** * Returns the first power of two equal or bigger than the input. @@ -126,7 +128,13 @@ class OpenGLImageHelper final : public ImageHelper static int powerOfTwo(const int input) A_WARN_UNUSED; Image *glLoad(SDL_Surface *tmpImage, - int width = 0, int height = 0) const A_WARN_UNUSED; + int width = 0, int height = 0) A_WARN_UNUSED; + + GLuint getNewTexture(); + + static const size_t texturesSize = 10; + size_t mFreeTextureIndex; + GLuint mTextures[texturesSize]; static int mTextureSize; static bool mBlur; |