From 2648723c83dce98a687c50b896dd842c7fb36b23 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Thu, 14 Apr 2011 15:22:43 +0000 Subject: [PATCH] Cleaned up DXT1 support --- src/osg/Image.cpp | 14 ++------------ src/osg/dxtctool.cpp | 5 +++++ src/osgPlugins/dds/ReaderWriterDDS.cpp | 8 ++++---- 3 files changed, 11 insertions(+), 16 deletions(-) diff --git a/src/osg/Image.cpp b/src/osg/Image.cpp index 6602319cc..ca11ac6d9 100644 --- a/src/osg/Image.cpp +++ b/src/osg/Image.cpp @@ -633,18 +633,7 @@ void Image::setInternalTextureFormat(GLint internalFormat) void Image::setPixelFormat(GLenum pixelFormat) { - if (_pixelFormat==pixelFormat) return; // do nothing if the same. - - if (_pixelFormat==0 || computeNumComponents(_pixelFormat)==computeNumComponents(pixelFormat)) - { - // if the two formats have the same number of componets then - // we can do a straight swap. - _pixelFormat = pixelFormat; - } - else - { - OSG_WARN<<"Image::setPixelFormat(..) - warning, attempt to reset the pixel format with a different number of components."<(imageData); @@ -209,10 +211,13 @@ bool CompressedImageTranslucent(size_t width, size_t height, GLenum format, void } return false; } + case(GL_COMPRESSED_RGBA_S3TC_DXT3_EXT): return true; + case(GL_COMPRESSED_RGBA_S3TC_DXT5_EXT): return true; + default: break; } diff --git a/src/osgPlugins/dds/ReaderWriterDDS.cpp b/src/osgPlugins/dds/ReaderWriterDDS.cpp index 8c535cf77..68fe9467c 100644 --- a/src/osgPlugins/dds/ReaderWriterDDS.cpp +++ b/src/osgPlugins/dds/ReaderWriterDDS.cpp @@ -924,10 +924,10 @@ public: ReaderWriterDDS() { supportsExtension("dds","DDS image format"); - supportsOption("dds_dxt1_rgb","set the pixel format of DXT1 encoded images to be RGB"); - supportsOption("dds_dxt1_rgba","set the pixel format of DXT1 encoded images to be RGBA"); - supportsOption("dds_dxt1_detect_rgba","For DXT1 encode images set the pixel format according to presence of transparent pixels."); - supportsOption("dds_flip","flip the image about the horizontl axis"); + supportsOption("dds_dxt1_rgb","Set the pixel format of DXT1 encoded images to be RGB variant of DXT1"); + supportsOption("dds_dxt1_rgba","Set the pixel format of DXT1 encoded images to be RGBA variant of DXT1"); + supportsOption("dds_dxt1_detect_rgba","For DXT1 encode images set the pixel format according to presence of transparent pixels"); + supportsOption("dds_flip","Flip the image about the horizontl axis"); } virtual const char* className() const