From e4337621056b2dacfbda5d10b07eb6473bd931d0 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Sat, 15 Sep 2007 17:36:03 +0000 Subject: [PATCH] From David Spilling, "Given no replies to my recent "does anybody use the DDS writer" query, I was emboldened to submit this very small patch. The bitmasks for RGBA and RGB have been modified in the writer portion of the code (line 765 onwards). This is now consistent with what the DDS plugin reads. In terms of testing, note that many 3rd party applications erroneously ignore the bitmasks in the file, and assume a BGRA order." --- src/osgPlugins/dds/ReaderWriterDDS.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/osgPlugins/dds/ReaderWriterDDS.cpp b/src/osgPlugins/dds/ReaderWriterDDS.cpp index fd9a66db0..6cfac53b4 100644 --- a/src/osgPlugins/dds/ReaderWriterDDS.cpp +++ b/src/osgPlugins/dds/ReaderWriterDDS.cpp @@ -764,9 +764,9 @@ bool WriteDDSFile(const osg::Image *img, std::ostream& fout) //Uncompressed case GL_RGBA: { - ddpf.dwRBitMask = 0x00ff0000; + ddpf.dwRBitMask = 0x000000ff; ddpf.dwGBitMask = 0x0000ff00; - ddpf.dwBBitMask = 0x000000ff; + ddpf.dwBBitMask = 0x00ff0000; ddpf.dwRGBAlphaBitMask = 0xff000000; PF_flags |= (DDPF_ALPHAPIXELS | DDPF_RGB); ddpf.dwRGBBitCount = pixelSize; @@ -776,9 +776,9 @@ bool WriteDDSFile(const osg::Image *img, std::ostream& fout) break; case GL_BGRA: { - ddpf.dwBBitMask = 0x00ff0000; + ddpf.dwBBitMask = 0x000000ff; ddpf.dwGBitMask = 0x0000ff00; - ddpf.dwRBitMask = 0x000000ff; + ddpf.dwRBitMask = 0x00ff0000; ddpf.dwRGBAlphaBitMask = 0xff000000; PF_flags |= (DDPF_ALPHAPIXELS | DDPF_RGB); ddpf.dwRGBBitCount = pixelSize; @@ -798,9 +798,9 @@ bool WriteDDSFile(const osg::Image *img, std::ostream& fout) break; case GL_RGB: { - ddpf.dwRBitMask = 0x00ff0000; - ddpf.dwGBitMask = 0x0000ff00; - ddpf.dwBBitMask = 0x000000ff; + ddpf.dwRBitMask = 0x000000ff; + ddpf.dwGBitMask = 0x0000ff00; + ddpf.dwBBitMask = 0x00ff0000; PF_flags |= DDPF_RGB; ddpf.dwRGBBitCount = pixelSize; ddsd.lPitch = img->getRowSizeInBytes();