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/image.cpp | |
parent | 129b19f69fbbdcd896150aa8faa7f20254169c0c (diff) | |
download | manaverse-70f471c5322231d7651c0275df46b3a9547f9ac0.tar.gz manaverse-70f471c5322231d7651c0275df46b3a9547f9ac0.tar.bz2 manaverse-70f471c5322231d7651c0275df46b3a9547f9ac0.tar.xz manaverse-70f471c5322231d7651c0275df46b3a9547f9ac0.zip |
Add option for enable textures compression (disabled by default)
Diffstat (limited to 'src/resources/image.cpp')
-rw-r--r-- | src/resources/image.cpp | 17 |
1 files changed, 15 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 |