diff options
author | Andrei Karas <akaras@inbox.ru> | 2012-05-17 22:31:39 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2012-05-17 22:31:39 +0300 |
commit | a736a01786b9ad6df5dba9955fcac96300c537a2 (patch) | |
tree | d89fc92c489f0ab0c124196e5bc89b9c5e21d703 | |
parent | 61c92f38a7b9a5b30149bf5ae0cc106abc0482dc (diff) | |
download | manaplus-a736a01786b9ad6df5dba9955fcac96300c537a2.tar.gz manaplus-a736a01786b9ad6df5dba9955fcac96300c537a2.tar.bz2 manaplus-a736a01786b9ad6df5dba9955fcac96300c537a2.tar.xz manaplus-a736a01786b9ad6df5dba9955fcac96300c537a2.zip |
Add support for normal internal texture format (before was old format).
Add option to switch new/old texture format.
-rw-r--r-- | src/defaults.cpp | 1 | ||||
-rw-r--r-- | src/graphicsmanager.cpp | 83 | ||||
-rw-r--r-- | src/gui/setup_perfomance.cpp | 3 | ||||
-rw-r--r-- | src/resources/image.cpp | 2 |
4 files changed, 54 insertions, 35 deletions
diff --git a/src/defaults.cpp b/src/defaults.cpp index 22ec65dfd..fda474fb1 100644 --- a/src/defaults.cpp +++ b/src/defaults.cpp @@ -256,6 +256,7 @@ DefaultsData* getConfigDefaults() AddDEF(configData, "compresstextures", false); AddDEF(configData, "rectangulartextures", true); AddDEF(configData, "networksleep", 0); + AddDEF(configData, "newtextures", true); return configData; } diff --git a/src/graphicsmanager.cpp b/src/graphicsmanager.cpp index fec1a9a6d..fbe852588 100644 --- a/src/graphicsmanager.cpp +++ b/src/graphicsmanager.cpp @@ -87,48 +87,63 @@ bool GraphicsManager::supportExtension(const std::string &ext) void GraphicsManager::updateTextureFormat() { #ifdef USE_OPENGL - if (!config.getBoolValue("compresstextures")) - return; - - if (supportExtension("GL_ARB_texture_compression")) + if (config.getBoolValue("compresstextures")) { - if (supportExtension("GL_EXT_texture_compression_s3tc") - || supportExtension("3DFX_texture_compression_FXT1")) + // using extensions if can + if (supportExtension("GL_ARB_texture_compression")) { - GLint num; - GLint *formats = nullptr; - glGetIntegerv(GL_NUM_COMPRESSED_TEXTURE_FORMATS, &num); - logger->log("support %d compressed formats", num); - formats = new GLint[num > 10 ? num : 10]; - glGetIntegerv(GL_COMPRESSED_TEXTURE_FORMATS, formats); - for (int f = 0; f < num; f ++) + if (supportExtension("GL_EXT_texture_compression_s3tc") + || supportExtension("3DFX_texture_compression_FXT1")) { - if (formats[f] == GL_COMPRESSED_RGBA_S3TC_DXT5_EXT) - { - delete []formats; - Image::setInternalTextureType( - GL_COMPRESSED_RGBA_S3TC_DXT5_EXT); - logger->log("using s3tc texture compression"); - return; - } - else if (formats[f] == GL_COMPRESSED_RGBA_FXT1_3DFX) + GLint num; + GLint *formats = nullptr; + glGetIntegerv(GL_NUM_COMPRESSED_TEXTURE_FORMATS, &num); + logger->log("support %d compressed formats", num); + formats = new GLint[num > 10 ? num : 10]; + glGetIntegerv(GL_COMPRESSED_TEXTURE_FORMATS, formats); + for (int f = 0; f < num; f ++) { - delete []formats; - Image::setInternalTextureType( - GL_COMPRESSED_RGBA_FXT1_3DFX); - logger->log("using fxt1 texture compression"); - return; + if (formats[f] == GL_COMPRESSED_RGBA_S3TC_DXT5_EXT) + { + delete []formats; + Image::setInternalTextureType( + GL_COMPRESSED_RGBA_S3TC_DXT5_EXT); + logger->log1("using s3tc texture compression"); + return; + } + else if (formats[f] == GL_COMPRESSED_RGBA_FXT1_3DFX) + { + delete []formats; + Image::setInternalTextureType( + GL_COMPRESSED_RGBA_FXT1_3DFX); + logger->log1("using fxt1 texture compression"); + return; + } } + Image::setInternalTextureType(GL_COMPRESSED_RGBA_ARB); + logger->log1("using texture compression"); + return; + } + else + { + Image::setInternalTextureType(GL_COMPRESSED_RGBA_ARB); + logger->log1("using texture compression"); + return; } - Image::setInternalTextureType(GL_COMPRESSED_RGBA_ARB); - logger->log("using texture compression"); - } - else - { - Image::setInternalTextureType(GL_COMPRESSED_RGBA_ARB); - logger->log("using texture compression"); } } + + // using default formats + if (config.getBoolValue("newtextures")) + { + Image::setInternalTextureType(GL_RGBA); + logger->log1("using RGBA texture format"); + } + else + { + Image::setInternalTextureType(4); + logger->log1("using 4 texture format"); + } #endif } diff --git a/src/gui/setup_perfomance.cpp b/src/gui/setup_perfomance.cpp index a40a400f3..8d6592315 100644 --- a/src/gui/setup_perfomance.cpp +++ b/src/gui/setup_perfomance.cpp @@ -99,6 +99,9 @@ Setup_Perfomance::Setup_Perfomance() new SetupItemCheckBox(_("Enable rectangular texture extension (OpenGL)"), "", "rectangulartextures", this, "rectangulartexturesEvent"); + new SetupItemCheckBox(_("Use new texture internal format (OpenGL)"), + "", "newtextures", this, "newtexturesEvent"); + setDimension(gcn::Rectangle(0, 0, 550, 350)); } diff --git a/src/resources/image.cpp b/src/resources/image.cpp index fa9f1462a..34a2e22b7 100644 --- a/src/resources/image.cpp +++ b/src/resources/image.cpp @@ -44,7 +44,7 @@ #ifdef USE_OPENGL int Image::mUseOpenGL = 0; int Image::mTextureType = 0; -int Image::mInternalTextureType = 4; +int Image::mInternalTextureType = GL_RGBA8; int Image::mTextureSize = 0; bool Image::mBlur = true; #endif |