Changeset 10264

Show
Ignore:
Timestamp:
05/25/09 13:12:38 (6 years ago)
Author:
robert
Message:

From Wojciech Lewandowski, "Two fixes for LUMINANCE and ALPHA_LUMINACE pixel formats written into DDS file. Component masks were incorrect. I tested results with ultimate DDS compatibitlity tester ie Microsoft DirectX Texture tool ;-). I have also added comment with warning about possible problems when writing other than 8 bit component pixel formats.
"

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • OpenSceneGraph/trunk/src/osgPlugins/dds/ReaderWriterDDS.cpp

    r9343 r10264  
    1010*                    Author: Sebastien Domine, NVIDIA Corporation 
    1111* 
    12 *    CREATED BY:        Rune Schmidt Jensen, rsj@uni-dk 
     12*    CREATED BY:     Rune Schmidt Jensen, rsj@uni-dk 
    1313* 
    1414*    HISTORY:        Created   31.03.2003 
    1515*             Modified  13.05.2004 
    1616*                by George Tarantilis, gtaranti@nps.navy.mil 
     17*             Modified  22.05.2009  
     18*                Wojtek Lewandowski, lewandowski@ai.com.pl  
     19* 
     20*    WARNING:  
     21*          Bit Masks in the WrtiteDDS are set for 8 bit components  
     22*          write with 4 or 16 bit components will  
     23*          probably produce corrupted file  
     24*          Wojtek Lewandowski 2009-05-22  
    1725* 
    1826**********************************************************************/ 
     
    717725 
    718726 
    719  
    720  
    721  
    722  
    723727bool WriteDDSFile(const osg::Image *img, std::ostream& fout) 
    724728{ 
     
    794798    case GL_LUMINANCE_ALPHA: 
    795799        { 
    796             ddpf.dwRBitMask         = 0x00ff0000; 
    797             ddpf.dwRGBAlphaBitMask  = 0x000000ff; 
     800            ddpf.dwRBitMask         = 0x000000ff; 
     801            ddpf.dwRGBAlphaBitMask  = 0x0000ff00; 
    798802            PF_flags |= (DDPF_ALPHAPIXELS | DDPF_LUMINANCE);   
    799803            ddpf.dwRGBBitCount = pixelSize;  
     
    815819    case GL_LUMINANCE: 
    816820        { 
    817             ddpf.dwRBitMask         = 0x00ff0000; 
     821            ddpf.dwRBitMask         = 0x000000ff; 
    818822            PF_flags |= DDPF_LUMINANCE; 
    819823            ddpf.dwRGBBitCount = pixelSize;