Fix for HDR DDS images

The DDS loader was not applying the correct internal format for certain HDR images (e.g. float/half_float formats)
This commit is contained in:
flashk 2018-10-03 14:21:03 -07:00 committed by Robert Osfield
parent ce90a9b2da
commit d48a304569

View File

@ -676,7 +676,7 @@ osg::Image* ReadDDSFile(std::istream& _istream, bool flipDDSRead)
break; break;
case 0x00000071: // A16B16G16R16F case 0x00000071: // A16B16G16R16F
OSG_INFO << "ReadDDSFile info : format = A16B16G16R16F" << std::endl; OSG_INFO << "ReadDDSFile info : format = A16B16G16R16F" << std::endl;
internalFormat = GL_RGBA; // why no transparency? internalFormat = GL_RGBA16F_ARB; // why no transparency?
pixelFormat = GL_RGBA; pixelFormat = GL_RGBA;
dataType = GL_HALF_FLOAT; dataType = GL_HALF_FLOAT;
break; break;
@ -704,19 +704,19 @@ osg::Image* ReadDDSFile(std::istream& _istream, bool flipDDSRead)
break; break;
case 0x00000072: // R32F case 0x00000072: // R32F
OSG_INFO << "ReadDDSFile info : format = R32F" << std::endl; OSG_INFO << "ReadDDSFile info : format = R32F" << std::endl;
internalFormat = GL_RGB; internalFormat = GL_R32F;
pixelFormat = GL_RED; pixelFormat = GL_RED;
dataType = GL_FLOAT; dataType = GL_FLOAT;
break; break;
case 0x0000006F: // R16F case 0x0000006F: // R16F
OSG_INFO << "ReadDDSFile info : format = R16F" << std::endl; OSG_INFO << "ReadDDSFile info : format = R16F" << std::endl;
internalFormat = GL_RGB; internalFormat = GL_R16F;
pixelFormat = GL_RED; pixelFormat = GL_RED;
dataType = GL_HALF_FLOAT; dataType = GL_HALF_FLOAT;
break; break;
case 0x00000074: // A32B32G32R32F case 0x00000074: // A32B32G32R32F
OSG_INFO << "ReadDDSFile info : format = A32B32G32R32F" << std::endl; OSG_INFO << "ReadDDSFile info : format = A32B32G32R32F" << std::endl;
internalFormat = GL_RGBA; internalFormat = GL_RGBA32F_ARB;
pixelFormat = GL_RGBA; pixelFormat = GL_RGBA;
dataType = GL_FLOAT; dataType = GL_FLOAT;
break; break;