summaryrefslogtreecommitdiff
path: root/src/graphicsmanager.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2012-05-17 22:31:39 +0300
committerAndrei Karas <akaras@inbox.ru>2012-05-17 22:31:39 +0300
commita736a01786b9ad6df5dba9955fcac96300c537a2 (patch)
treed89fc92c489f0ab0c124196e5bc89b9c5e21d703 /src/graphicsmanager.cpp
parent61c92f38a7b9a5b30149bf5ae0cc106abc0482dc (diff)
downloadmanaverse-a736a01786b9ad6df5dba9955fcac96300c537a2.tar.gz
manaverse-a736a01786b9ad6df5dba9955fcac96300c537a2.tar.bz2
manaverse-a736a01786b9ad6df5dba9955fcac96300c537a2.tar.xz
manaverse-a736a01786b9ad6df5dba9955fcac96300c537a2.zip
Add support for normal internal texture format (before was old format).
Add option to switch new/old texture format.
Diffstat (limited to 'src/graphicsmanager.cpp')
-rw-r--r--src/graphicsmanager.cpp83
1 files changed, 49 insertions, 34 deletions
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
}