Added disabling of mipmapping for non power of two textures

This commit is contained in:
Robert Osfield 2009-04-06 12:28:02 +00:00
parent 9852c299d5
commit cff4e3437a

View File

@ -749,10 +749,21 @@ void GeometryTechnique::applyColorLayers()
texture2D->setFilter(osg::Texture::MIN_FILTER, colorLayer->getMinFilter());
texture2D->setFilter(osg::Texture::MAG_FILTER, colorLayer->getMagFilter());
texture2D->setWrap(osg::Texture::WRAP_S,osg::Texture::CLAMP_TO_EDGE);
texture2D->setWrap(osg::Texture::WRAP_T,osg::Texture::CLAMP_TO_EDGE);
bool mipMapping = !(texture2D->getFilter(osg::Texture::MIN_FILTER)==osg::Texture::LINEAR || texture2D->getFilter(osg::Texture::MIN_FILTER)==osg::Texture::NEAREST);
bool s_NotPowerOfTwo = image->s()==0 || (image->s() & (image->s() - 1));
bool t_NotPowerOfTwo = image->t()==0 || (image->t() & (image->t() - 1));
if (mipMapping && (s_NotPowerOfTwo || t_NotPowerOfTwo))
{
osg::notify(osg::INFO)<<"Disabling mipmapping for non power of two tile size("<<image->s()<<", "<<image->t()<<")"<<std::endl;
texture2D->setFilter(osg::Texture::MIN_FILTER, osg::Texture::LINEAR);
}
layerToTextureMap[colorLayer] = texture2D;
// osg::notify(osg::NOTICE)<<"Creating new ImageLayer texture "<<layerNum<<" image->s()="<<image->s()<<" image->t()="<<image->t()<<std::endl;