summaryrefslogtreecommitdiff
path: root/src/resources
diff options
context:
space:
mode:
Diffstat (limited to 'src/resources')
-rw-r--r--src/resources/image.cpp17
-rw-r--r--src/resources/image.h9
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