Fix for nvtt plugin to support RGTC1/RGTC2 pixel format.

Thanks to this simple fix it's possible to compress red/red-green channel of RGB/RGBA image to GL_COMPRESSED_RED_RGTC1_EXT/GL_COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT pixel format.
This commit is contained in:
Marcin Hajder 2016-05-31 12:45:28 +01:00 committed by Robert Osfield
parent 1823341cce
commit 37258df59c

View File

@ -119,6 +119,12 @@ bool NVTTProcessor::OSGImageOutputHandler::assignImage(osg::Image& image)
case nvtt::Format_DXT5:
pixelFormat = GL_COMPRESSED_RGBA_S3TC_DXT5_EXT;
break;
case nvtt::Format_BC4:
pixelFormat = GL_COMPRESSED_RED_RGTC1_EXT;
break;
case nvtt::Format_BC5:
pixelFormat = GL_COMPRESSED_RED_GREEN_RGTC2_EXT;
break;
default:
OSG_WARN<<" Invalid or not supported format"<<std::endl;
return false;
@ -333,6 +339,12 @@ void NVTTProcessor::compress(osg::Image& image, osg::Texture::InternalFormatMode
case osg::Texture::USE_S3TC_DXT5_COMPRESSION:
format = nvtt::Format_DXT5;
break;
case osg::Texture::USE_RGTC1_COMPRESSION:
format = nvtt::Format_BC4;
break;
case osg::Texture::USE_RGTC2_COMPRESSION:
format = nvtt::Format_BC5;
break;
default:
OSG_WARN<<" Invalid or not supported compress format"<<std::endl;
return;