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."
This commit is contained in:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user