From 70f471c5322231d7651c0275df46b3a9547f9ac0 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Thu, 26 Apr 2012 22:24:38 +0300 Subject: Add option for enable textures compression (disabled by default) --- src/resources/image.cpp | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'src/resources/image.cpp') 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 -- cgit v1.2.3-70-g09d2