summaryrefslogtreecommitdiff
path: root/src/openglgraphics.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2012-06-30 00:05:03 +0300
committerAndrei Karas <akaras@inbox.ru>2012-06-30 00:05:03 +0300
commit7e3170fa2b3f602428404e2f82fdb8c6640ea787 (patch)
treeec3cab5f60f1e746241dc37f66481be0b416d69c /src/openglgraphics.cpp
parent8448f1c4c07f49caa83a755e732918320e0e161f (diff)
downloadplus-7e3170fa2b3f602428404e2f82fdb8c6640ea787.tar.gz
plus-7e3170fa2b3f602428404e2f82fdb8c6640ea787.tar.bz2
plus-7e3170fa2b3f602428404e2f82fdb8c6640ea787.tar.xz
plus-7e3170fa2b3f602428404e2f82fdb8c6640ea787.zip
Extend bind texture debug logging.
Diffstat (limited to 'src/openglgraphics.cpp')
-rw-r--r--src/openglgraphics.cpp32
1 files changed, 26 insertions, 6 deletions
diff --git a/src/openglgraphics.cpp b/src/openglgraphics.cpp
index ab65fd7ee..80a28dcd2 100644
--- a/src/openglgraphics.cpp
+++ b/src/openglgraphics.cpp
@@ -215,7 +215,7 @@ bool OpenGLGraphics::drawImage(const Image *image, int srcX, int srcY,
glColor4f(1.0f, 1.0f, 1.0f, image->mAlpha);
#ifdef DEBUG_BIND_TEXTURE
- logger->log("bind: " + image->getIdPath());
+ debugBindTexture(image);
#endif
bindTexture(OpenGLImageHelper::mTextureType, image->mGLImage);
@@ -275,7 +275,7 @@ bool OpenGLGraphics::drawRescaledImage(Image *image, int srcX, int srcY,
glColor4f(1.0f, 1.0f, 1.0f, image->mAlpha);
#ifdef DEBUG_BIND_TEXTURE
- logger->log("bind: " + image->getIdPath());
+ debugBindTexture(image);
#endif
bindTexture(OpenGLImageHelper::mTextureType, image->mGLImage);
@@ -331,7 +331,7 @@ void OpenGLGraphics::drawImagePattern(const Image *image, int x, int y,
glColor4f(1.0f, 1.0f, 1.0f, image->mAlpha);
#ifdef DEBUG_BIND_TEXTURE
- logger->log("bind: " + image->getIdPath());
+ debugBindTexture(image);
#endif
bindTexture(OpenGLImageHelper::mTextureType, image->mGLImage);
@@ -468,7 +468,7 @@ void OpenGLGraphics::drawRescaledImagePattern(Image *image,
glColor4f(1.0f, 1.0f, 1.0f, image->mAlpha);
#ifdef DEBUG_BIND_TEXTURE
- logger->log("bind: " + image->getIdPath());
+ debugBindTexture(image);
#endif
bindTexture(OpenGLImageHelper::mTextureType, image->mGLImage);
@@ -611,7 +611,7 @@ void OpenGLGraphics::drawImagePattern2(GraphicsVertexes *vert,
glColor4f(1.0f, 1.0f, 1.0f, image->mAlpha);
#ifdef DEBUG_BIND_TEXTURE
- logger->log("bind: " + image->getIdPath());
+ debugBindTexture(image);
#endif
bindTexture(OpenGLImageHelper::mTextureType, image->mGLImage);
setTexturingAndBlending(true);
@@ -928,7 +928,7 @@ void OpenGLGraphics::drawTile(ImageVertexes *vert)
glColor4f(1.0f, 1.0f, 1.0f, image->mAlpha);
#ifdef DEBUG_BIND_TEXTURE
- logger->log("bind: " + image->getIdPath());
+ debugBindTexture(image);
#endif
bindTexture(OpenGLImageHelper::mTextureType, image->mGLImage);
setTexturingAndBlending(true);
@@ -1394,4 +1394,24 @@ void OpenGLGraphics::dumpSettings()
}
}
+#ifdef DEBUG_BIND_TEXTURE
+void OpenGLGraphics::debugBindTexture(const Image *image)
+{
+ const std::string texture = image->getIdPath();
+ if (mOldTexture != texture)
+ {
+ if (!mOldTexture.empty() && !texture.empty())
+ {
+ logger->log("bind: %s to %s", mOldTexture.c_str(),
+ texture.c_str());
+ }
+ mOldTexture = texture;
+ }
+}
+#else
+void OpenGLGraphics::debugBindTexture(Image *image A_UNUSED)
+{
+}
+#endif
+
#endif // USE_OPENGL