summaryrefslogtreecommitdiff
path: root/src/resources/atlas
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2017-04-25 21:47:27 +0300
committerAndrei Karas <akaras@inbox.ru>2017-04-26 00:47:34 +0300
commit69cfcb156d4224753d439ac3cd7708366e27e365 (patch)
tree89ea4bc8a5b1b61ac46619f021d5e9905f5e1642 /src/resources/atlas
parent4821f538a888370eb80ec28f9bab269a4427a63c (diff)
downloadManaVerse-69cfcb156d4224753d439ac3cd7708366e27e365.tar.gz
ManaVerse-69cfcb156d4224753d439ac3cd7708366e27e365.tar.bz2
ManaVerse-69cfcb156d4224753d439ac3cd7708366e27e365.tar.xz
ManaVerse-69cfcb156d4224753d439ac3cd7708366e27e365.zip
Report also altas creation OpenGL errors if enabled.
Diffstat (limited to 'src/resources/atlas')
-rw-r--r--src/resources/atlas/atlasmanager.cpp23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/resources/atlas/atlasmanager.cpp b/src/resources/atlas/atlasmanager.cpp
index 4f38439ad..f8251ba7d 100644
--- a/src/resources/atlas/atlasmanager.cpp
+++ b/src/resources/atlas/atlasmanager.cpp
@@ -313,6 +313,10 @@ void AtlasManager::createSDLAtlas(TextureAtlas *const atlas)
}
BLOCK_END("AtlasManager::createSDLAtlas create surface")
+#ifdef OPENGLERRORS
+ logger->log("OpenGL debug: creating atlase %dx%d", width, height);
+#endif // OPENGLERRORS
+
Image *image = imageHelper->loadSurface(surface);
// free SDL atlas surface
MSDL_FreeSurface(surface);
@@ -330,6 +334,25 @@ void AtlasManager::createSDLAtlas(TextureAtlas *const atlas)
AtlasItem *const item = *it;
imageHelper->copySurfaceToImage(image, item->x, item->y,
item->image->mSDLSurface);
+#ifdef OPENGLERRORS
+ logger->log("OpenGL debug: put atlas image %s (size %dx%d),"
+ " into %d,%d to %d,%d",
+ item->name.c_str(),
+ item->image->mSDLSurface->w,
+ item->image->mSDLSurface->h,
+ item->x,
+ item->y,
+ item->x + item->image->mSDLSurface->w - 1,
+ item->y + item->image->mSDLSurface->h - 1);
+ if (item->x >= width)
+ logger->log("OpenGL error: start x position outside of atlas");
+ if (item->y >= height)
+ logger->log("OpenGL error: start y position outside of atlas");
+ if (item->x + item->image->mSDLSurface->w - 1 >= width)
+ logger->log("OpenGL error: end x position outside of atlas");
+ if (item->y + item->image->mSDLSurface->h - 1 >= height)
+ logger->log("OpenGL error: end y position outside of atlas");
+#endif // OPENGLERRORS
}
atlas->atlasImage = image;
BLOCK_END("AtlasManager::createSDLAtlas")