summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-08-18 13:34:32 +0300
committerAndrei Karas <akaras@inbox.ru>2014-08-18 13:34:32 +0300
commitfcff34eab40f80ec110c4370154a0a05f372cc55 (patch)
tree508fe7cd06ee8037d9ee1354c22d76688c55f730
parent97d7980671ab621bfee994c0acf410ee2012ddcd (diff)
downloadmv-fcff34eab40f80ec110c4370154a0a05f372cc55.tar.gz
mv-fcff34eab40f80ec110c4370154a0a05f372cc55.tar.bz2
mv-fcff34eab40f80ec110c4370154a0a05f372cc55.tar.xz
mv-fcff34eab40f80ec110c4370154a0a05f372cc55.zip
Simplify texture compression usage.
-rw-r--r--src/graphicsmanager.cpp24
1 files changed, 9 insertions, 15 deletions
diff --git a/src/graphicsmanager.cpp b/src/graphicsmanager.cpp
index 860015c5c..2a8be3309 100644
--- a/src/graphicsmanager.cpp
+++ b/src/graphicsmanager.cpp
@@ -87,6 +87,10 @@ GraphicsManager graphicsManager;
RenderType openGLMode = RENDER_SOFTWARE;
+#define useCompression(name) \
+ OpenGLImageHelper::setInternalTextureType(name); \
+ logger->log("using " #name " texture compression");
+
const int densitySize = 6;
const std::string densityNames[] =
@@ -666,9 +670,7 @@ void GraphicsManager::updateTextureFormat() const
if (compressionFormat == 1)
{
delete []formats;
- OpenGLImageHelper::setInternalTextureType(
- GL_COMPRESSED_RGBA_S3TC_DXT5_EXT);
- logger->log1("using s3tc texture compression");
+ useCompression(GL_COMPRESSED_RGBA_S3TC_DXT5_EXT);
return;
}
break;
@@ -676,9 +678,7 @@ void GraphicsManager::updateTextureFormat() const
if (compressionFormat == 2)
{
delete []formats;
- OpenGLImageHelper::setInternalTextureType(
- GL_COMPRESSED_RGBA_FXT1_3DFX);
- logger->log1("using fxt1 texture compression");
+ useCompression(GL_COMPRESSED_RGBA_FXT1_3DFX);
return;
}
break;
@@ -686,9 +686,7 @@ void GraphicsManager::updateTextureFormat() const
if (compressionFormat == 4)
{
delete []formats;
- OpenGLImageHelper::setInternalTextureType(
- GL_COMPRESSED_RGBA_BPTC_UNORM_ARB);
- logger->log1("using bptc texture compression");
+ useCompression(GL_COMPRESSED_RGBA_BPTC_UNORM_ARB);
return;
}
break;
@@ -699,9 +697,7 @@ void GraphicsManager::updateTextureFormat() const
delete []formats;
if (compressionFormat == 3)
{
- OpenGLImageHelper::setInternalTextureType(
- GL_COMPRESSED_RGBA_ARB);
- logger->log1("using ARB texture compression");
+ useCompression(GL_COMPRESSED_RGBA_ARB);
return;
}
@@ -709,9 +705,7 @@ void GraphicsManager::updateTextureFormat() const
if (compressionFormat == 4
&& supportExtension("GL_ARB_texture_compression_bptc"))
{
- OpenGLImageHelper::setInternalTextureType(
- GL_COMPRESSED_RGBA_BPTC_UNORM_ARB);
- logger->log1("using bptc texture compression");
+ useCompression(GL_COMPRESSED_RGBA_BPTC_UNORM_ARB);
return;
}
}