From 81b52381745a96fcbae36aa744585ac1a1ff5d18 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Wed, 27 Jun 2012 22:44:43 +0300 Subject: Add debug for binding textures. --- src/localconsts.h | 1 + src/openglgraphics.cpp | 18 ++++++++++++++++++ src/resources/resource.h | 3 ++- src/resources/subimage.cpp | 6 ++++++ 4 files changed, 27 insertions(+), 1 deletion(-) diff --git a/src/localconsts.h b/src/localconsts.h index 7bc5555ed..33cf52255 100644 --- a/src/localconsts.h +++ b/src/localconsts.h @@ -33,3 +33,4 @@ #endif //#define DEBUG_CONFIG 1 +//#define DEBUG_BIND_TEXTURE 1 diff --git a/src/openglgraphics.cpp b/src/openglgraphics.cpp index 7d32fd476..ab65fd7ee 100644 --- a/src/openglgraphics.cpp +++ b/src/openglgraphics.cpp @@ -214,6 +214,9 @@ bool OpenGLGraphics::drawImage(const Image *image, int srcX, int srcY, if (!useColor) glColor4f(1.0f, 1.0f, 1.0f, image->mAlpha); +#ifdef DEBUG_BIND_TEXTURE + logger->log("bind: " + image->getIdPath()); +#endif bindTexture(OpenGLImageHelper::mTextureType, image->mGLImage); setTexturingAndBlending(true); @@ -271,6 +274,9 @@ bool OpenGLGraphics::drawRescaledImage(Image *image, int srcX, int srcY, if (!useColor) glColor4f(1.0f, 1.0f, 1.0f, image->mAlpha); +#ifdef DEBUG_BIND_TEXTURE + logger->log("bind: " + image->getIdPath()); +#endif bindTexture(OpenGLImageHelper::mTextureType, image->mGLImage); setTexturingAndBlending(true); @@ -324,6 +330,9 @@ 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()); +#endif bindTexture(OpenGLImageHelper::mTextureType, image->mGLImage); setTexturingAndBlending(true); @@ -458,6 +467,9 @@ void OpenGLGraphics::drawRescaledImagePattern(Image *image, glColor4f(1.0f, 1.0f, 1.0f, image->mAlpha); +#ifdef DEBUG_BIND_TEXTURE + logger->log("bind: " + image->getIdPath()); +#endif bindTexture(OpenGLImageHelper::mTextureType, image->mGLImage); setTexturingAndBlending(true); @@ -598,6 +610,9 @@ void OpenGLGraphics::drawImagePattern2(GraphicsVertexes *vert, OpenGLGraphicsVertexes *ogl = vert->getOGL(); glColor4f(1.0f, 1.0f, 1.0f, image->mAlpha); +#ifdef DEBUG_BIND_TEXTURE + logger->log("bind: " + image->getIdPath()); +#endif bindTexture(OpenGLImageHelper::mTextureType, image->mGLImage); setTexturingAndBlending(true); @@ -912,6 +927,9 @@ void OpenGLGraphics::drawTile(ImageVertexes *vert) OpenGLGraphicsVertexes *ogl = vert->ogl; glColor4f(1.0f, 1.0f, 1.0f, image->mAlpha); +#ifdef DEBUG_BIND_TEXTURE + logger->log("bind: " + image->getIdPath()); +#endif bindTexture(OpenGLImageHelper::mTextureType, image->mGLImage); setTexturingAndBlending(true); diff --git a/src/resources/resource.h b/src/resources/resource.h index 1b62c0206..d8f4a7f11 100644 --- a/src/resources/resource.h +++ b/src/resources/resource.h @@ -89,8 +89,9 @@ class Resource */ virtual ~Resource(); - private: std::string mIdPath; /**< Path identifying this resource. */ + + private: time_t mTimeStamp; /**< Time at which the resource was orphaned. */ unsigned mRefCount; /**< Reference count. */ std::string mName; diff --git a/src/resources/subimage.cpp b/src/resources/subimage.cpp index bc9b0794f..294a966c4 100644 --- a/src/resources/subimage.cpp +++ b/src/resources/subimage.cpp @@ -46,6 +46,9 @@ SubImage::SubImage(Image *parent, SDL_Surface *image, mHasAlphaChannel = mParent->hasAlphaChannel(); mIsAlphaVisible = mHasAlphaChannel; mAlphaChannel = mParent->SDLgetAlphaChannel(); +#ifdef DEBUG_BIND_TEXTURE + mIdPath = parent->getIdPath(); +#endif } else { @@ -97,6 +100,9 @@ SubImage::SubImage(Image *parent, GLuint image, mInternalBounds.y = mParent->mBounds.y; mInternalBounds.w = mParent->mBounds.w; mInternalBounds.h = mParent->mBounds.h; +#ifdef DEBUG_BIND_TEXTURE + mIdPath = parent->getIdPath(); +#endif } else { -- cgit v1.2.3-70-g09d2