summaryrefslogtreecommitdiff
path: root/src/resources/image.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2011-05-08 02:50:15 +0300
committerAndrei Karas <akaras@inbox.ru>2011-05-08 02:50:15 +0300
commit373c794746bfe38d7abea0cedc446cb2aaa75c2e (patch)
tree03308276e8aabe045ed80f05f7382fe3f8553b5f /src/resources/image.cpp
parentcf09603b18f0158653723251445960d3bd534ea8 (diff)
downloadplus-373c794746bfe38d7abea0cedc446cb2aaa75c2e.tar.gz
plus-373c794746bfe38d7abea0cedc446cb2aaa75c2e.tar.bz2
plus-373c794746bfe38d7abea0cedc446cb2aaa75c2e.tar.xz
plus-373c794746bfe38d7abea0cedc446cb2aaa75c2e.zip
Add opengl texture counter for debugging.
Diffstat (limited to 'src/resources/image.cpp')
-rw-r--r--src/resources/image.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/resources/image.cpp b/src/resources/image.cpp
index d5db3b211..be7bb7f47 100644
--- a/src/resources/image.cpp
+++ b/src/resources/image.cpp
@@ -30,6 +30,7 @@
#include "opengl1graphics.h"
#endif
+#include "client.h"
#include "log.h"
#include "main.h"
@@ -217,6 +218,10 @@ void Image::unload()
{
glDeleteTextures(1, &mGLImage);
mGLImage = 0;
+#ifdef DEBUG_OPENGL_LEAKS
+ if (textures_count > 0)
+ textures_count --;
+#endif
}
#endif
}
@@ -675,6 +680,9 @@ Image *Image::_GLload(SDL_Surface *tmpImage)
glTexImage2D(mTextureType, 0, 4, tmpImage->w, tmpImage->h,
0, GL_RGBA, GL_UNSIGNED_BYTE, tmpImage->pixels);
+#ifdef DEBUG_OPENGL_LEAKS
+ textures_count ++;
+#endif
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
glTexParameteri(mTextureType, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(mTextureType, GL_TEXTURE_MAG_FILTER, GL_NEAREST);