diff --git a/src/Plugins/TgaImporter/TgaImporter.cpp b/src/Plugins/TgaImporter/TgaImporter.cpp index b60fec706..12aeac28f 100644 --- a/src/Plugins/TgaImporter/TgaImporter.cpp +++ b/src/Plugins/TgaImporter/TgaImporter.cpp @@ -33,6 +33,8 @@ #ifdef MAGNUM_TARGET_GLES #include +#include +#include #include #endif @@ -117,7 +119,12 @@ ImageData2D* TgaImporter::doImage2D(UnsignedInt) { /* Grayscale */ } else if(header.imageType == 3) { + #ifdef MAGNUM_TARGET_GLES + format = Context::current() && Context::current()->isExtensionSupported() ? + ImageFormat::Red : ImageFormat::Luminance; + #else format = ImageFormat::Red; + #endif if(header.bpp != 8) { Error() << "Trade::TgaImporter::TgaImporter::image2D(): unsupported grayscale bits-per-pixel:" << header.bpp; return nullptr; diff --git a/src/Plugins/TgaImporter/TgaImporter.h b/src/Plugins/TgaImporter/TgaImporter.h index 2bc6e9cbf..84bb20040 100644 --- a/src/Plugins/TgaImporter/TgaImporter.h +++ b/src/Plugins/TgaImporter/TgaImporter.h @@ -46,6 +46,16 @@ namespace Magnum { namespace Trade { @brief TGA image importer Supports uncompressed BGR, BGRA or grayscale images with 8 bits per channel. + +The images are imported with @ref ImageType "ImageType::UnsignedByte" and +@ref ImageFormat "ImageFormat::BGR", @ref ImageFormat "ImageFormat::BGRA" or +@ref ImageFormat "ImageFormat::Red" respectively. Grayscale images require +extension @extension{ARB,texture_rg}. + +In OpenGL ES BGR and BGRA images are converted to @ref ImageFormat "ImageFormat::RGB" +and @ref ImageFormat "ImageFormat::RGBA". In OpenGL ES 2.0, if @es_extension{EXT,texture_rg} +is not supported, grayscale images use @ref ImageFormat "ImageFormat::Luminance" +instead of @ref ImageFormat "ImageFormat::Red". */ class MAGNUM_TRADE_TGAIMPORTER_EXPORT TgaImporter: public AbstractImporter { public: