diff --git a/src/osgTerrain/GeometryTechnique.cpp b/src/osgTerrain/GeometryTechnique.cpp index 06d85eda1..9f51e374e 100644 --- a/src/osgTerrain/GeometryTechnique.cpp +++ b/src/osgTerrain/GeometryTechnique.cpp @@ -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("<s()<<", "<t()<<")"<setFilter(osg::Texture::MIN_FILTER, osg::Texture::LINEAR); + } + + layerToTextureMap[colorLayer] = texture2D; // osg::notify(osg::NOTICE)<<"Creating new ImageLayer texture "<s()="<s()<<" image->t()="<t()<