From 8fc97ea1cefab25de1c1bb243289e7d6e549718b Mon Sep 17 00:00:00 2001 From: Mathias Froehlich Date: Sun, 8 Jan 2012 23:16:57 +0100 Subject: [PATCH] Log images containing data depending on an extension. Print a descriptive warning on images that are given in a texture format that do only work in presence of an extension that might not be there at runtime. --- simgear/scene/model/ModelRegistry.cxx | 41 +++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/simgear/scene/model/ModelRegistry.cxx b/simgear/scene/model/ModelRegistry.cxx index 4cb710f4..9d8df432 100644 --- a/simgear/scene/model/ModelRegistry.cxx +++ b/simgear/scene/model/ModelRegistry.cxx @@ -231,6 +231,47 @@ ModelRegistry::readImage(const string& fileName, SG_LOG(SG_IO, SG_BULK, "Reading image \"" << res.getImage()->getFileName() << "\""); + // Check for precompressed textures that depend on an extension + switch (res.getImage()->getPixelFormat()) { + + // GL_EXT_texture_compression_s3tc + // patented, no way to decompress these + case GL_COMPRESSED_RGB_S3TC_DXT1_EXT: + case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT: + case GL_COMPRESSED_RGBA_S3TC_DXT3_EXT: + case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT: + + // GL_EXT_texture_sRGB + // patented, no way to decompress these + case GL_COMPRESSED_SRGB_S3TC_DXT1_EXT: + case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT: + case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT: + case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT: + + // GL_TDFX_texture_compression_FXT1 + // can decompress these in software but + // no code present in simgear. + case GL_COMPRESSED_RGB_FXT1_3DFX: + case GL_COMPRESSED_RGBA_FXT1_3DFX: + + // GL_EXT_texture_compression_rgtc + // can decompress these in software but + // no code present in simgear. + case GL_COMPRESSED_RED_RGTC1_EXT: + case GL_COMPRESSED_SIGNED_RED_RGTC1_EXT: + case GL_COMPRESSED_RED_GREEN_RGTC2_EXT: + case GL_COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT: + + SG_LOG(SG_IO, SG_ALERT, "Image \"" << res.getImage()->getFileName() + << "\" contains non portable compressed textures.\n" + "Usage of these textures depend on an extension that" + " is not guaranteed to be present."); + break; + + default: + break; + } + return res; } } -- 2.39.5