diff options
author | Andrei Karas <akaras@inbox.ru> | 2012-04-26 22:24:38 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2012-04-27 03:49:15 +0300 |
commit | 70f471c5322231d7651c0275df46b3a9547f9ac0 (patch) | |
tree | 9bc0e4948f8fcfab71c2b4f900dd4c0f16611a96 /src/resources | |
parent | 129b19f69fbbdcd896150aa8faa7f20254169c0c (diff) | |
download | plus-70f471c5322231d7651c0275df46b3a9547f9ac0.tar.gz plus-70f471c5322231d7651c0275df46b3a9547f9ac0.tar.bz2 plus-70f471c5322231d7651c0275df46b3a9547f9ac0.tar.xz plus-70f471c5322231d7651c0275df46b3a9547f9ac0.zip |
Add option for enable textures compression (disabled by default)
Diffstat (limited to 'src/resources')
-rw-r--r-- | src/resources/image.cpp | 17 | ||||
-rw-r--r-- | src/resources/image.h | 9 |
2 files changed, 24 insertions, 2 deletions
diff --git a/src/resources/image.cpp b/src/resources/image.cpp index 54a969d57..274262304 100644 --- a/src/resources/image.cpp +++ b/src/resources/image.cpp @@ -44,6 +44,7 @@ #ifdef USE_OPENGL int Image::mUseOpenGL = 0; int Image::mTextureType = 0; +int Image::mInternalTextureType = 4; int Image::mTextureSize = 0; bool Image::mBlur = true; #endif @@ -202,7 +203,8 @@ Image *Image::createTextSurface(SDL_Surface *tmpImage, float alpha) if (mUseOpenGL) { img = _GLload(tmpImage); - img->setAlpha(alpha); + if (img) + img->setAlpha(alpha); return img; } #endif @@ -778,9 +780,20 @@ Image *Image::_GLload(SDL_Surface *tmpImage) glTexParameteri(mTextureType, GL_TEXTURE_MAG_FILTER, GL_NEAREST); } - glTexImage2D(mTextureType, 0, 4, tmpImage->w, tmpImage->h, + glTexImage2D(mTextureType, 0, mInternalTextureType, + tmpImage->w, tmpImage->h, 0, GL_RGBA, GL_UNSIGNED_BYTE, tmpImage->pixels); +/* + GLint compressed; + glGetTexLevelParameteriv(mTextureType, 0, + GL_TEXTURE_COMPRESSED_ARB, &compressed); + if (compressed) + logger->log("image compressed"); + else + logger->log("image not compressed"); +*/ + #ifdef DEBUG_OPENGL_LEAKS textures_count ++; #endif diff --git a/src/resources/image.h b/src/resources/image.h index 17eb3ec93..d4cfaa9ef 100644 --- a/src/resources/image.h +++ b/src/resources/image.h @@ -215,10 +215,19 @@ class Image : public Resource static int getTextureType() { return mTextureType; } + static int getInternalTextureType() + { return mInternalTextureType; } + + static void setInternalTextureType(int n) + { mInternalTextureType = n; } + static void setBlur(bool n) { mBlur = n; } static int mTextureType; + + static int mInternalTextureType; + #endif bool isHasAlphaChannel() const |