From 85d58aef208ae7c1f0ef5d449e17a1410a6eb04d Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sat, 26 Jan 2013 01:31:38 +0300 Subject: Add support for manual compression selection. --- src/graphicsmanager.cpp | 39 ++++++++++++++++++++++++++++----------- 1 file changed, 28 insertions(+), 11 deletions(-) (limited to 'src/graphicsmanager.cpp') diff --git a/src/graphicsmanager.cpp b/src/graphicsmanager.cpp index ba3ca95ad..f42aca9cb 100644 --- a/src/graphicsmanager.cpp +++ b/src/graphicsmanager.cpp @@ -493,7 +493,8 @@ bool GraphicsManager::supportExtension(const std::string &ext) void GraphicsManager::updateTextureFormat() { - if (config.getBoolValue("compresstextures")) + const int compressionFormat = config.getIntValue("compresstextures"); + if (compressionFormat) { // using extensions if can if (supportExtension("GL_ARB_texture_compression")) @@ -506,9 +507,13 @@ void GraphicsManager::updateTextureFormat() logger->log("support %d compressed formats", num); GLint *formats = new GLint[num > 10 ? num : 10]; glGetIntegerv(GL_COMPRESSED_TEXTURE_FORMATS, formats); + for (int f = 0; f < num; f ++) + logger->log(" 0x%x", formats[f]); + for (int f = 0; f < num; f ++) { - if (formats[f] == GL_COMPRESSED_RGBA_S3TC_DXT5_EXT) + if (formats[f] == GL_COMPRESSED_RGBA_S3TC_DXT5_EXT + && compressionFormat == 1) { delete []formats; OpenGLImageHelper::setInternalTextureType( @@ -516,7 +521,8 @@ void GraphicsManager::updateTextureFormat() logger->log1("using s3tc texture compression"); return; } - else if (formats[f] == GL_COMPRESSED_RGBA_FXT1_3DFX) + else if (formats[f] == GL_COMPRESSED_RGBA_FXT1_3DFX + && compressionFormat == 2) { delete []formats; OpenGLImageHelper::setInternalTextureType( @@ -525,19 +531,30 @@ void GraphicsManager::updateTextureFormat() return; } } - OpenGLImageHelper::setInternalTextureType( - GL_COMPRESSED_RGBA_ARB); - logger->log1("using texture compression"); - return; + delete []formats; + if (compressionFormat == 3) + { + OpenGLImageHelper::setInternalTextureType( + GL_COMPRESSED_RGBA_ARB); + logger->log1("using ARB texture compression"); + return; + } } else { - OpenGLImageHelper::setInternalTextureType( - GL_COMPRESSED_RGBA_ARB); - logger->log1("using texture compression"); - return; + if (compressionFormat == 3) + { + OpenGLImageHelper::setInternalTextureType( + GL_COMPRESSED_RGBA_ARB); + logger->log1("using ARB texture compression"); + return; + } } } + else + { + logger->log("no correct compression format found"); + } } // using default formats -- cgit v1.2.3-70-g09d2