From 33e7857af9e184c7f85c0bcad7c7b8db703bb6b2 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Tue, 28 Feb 2012 12:03:48 +0000 Subject: [PATCH] From Guillaume Millet, "When using the texture Atlas builder, it will convert from REPEAT to CLAMP all textures using only texcoord between [-0.001 1.001] to give a chance to create an Atlas. If the atlas creation failed for other reason (texture size, only one compatible texture, ...) the texture remain modified in CLAMP mode. But if you use texcoords between [0.0 1.0] using CLAMP mode instead REPEAT it is not safe because you will have a blend to the border color at extremities. If we want to have exactly the same rendering after changing mode from REPEAT to CLAMP we should use the CLAMP_TO_EDGE mode instead of CLAMP to avoid blending to border color at extremities. Please find as attachment the proposed patch against latest svn version. " --- src/osgUtil/Optimizer.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/osgUtil/Optimizer.cpp b/src/osgUtil/Optimizer.cpp index 09acb0112..c12a88496 100644 --- a/src/osgUtil/Optimizer.cpp +++ b/src/osgUtil/Optimizer.cpp @@ -4390,8 +4390,8 @@ void Optimizer::TextureAtlasVisitor::optimize() { // safe to convert into CLAMP wrap mode. OSG_INFO<<"Changing wrap mode to CLAMP"<setWrap(osg::Texture2D::WRAP_S, osg::Texture::CLAMP); - texture->setWrap(osg::Texture2D::WRAP_T, osg::Texture::CLAMP); + texture->setWrap(osg::Texture2D::WRAP_S, osg::Texture::CLAMP_TO_EDGE); + texture->setWrap(osg::Texture2D::WRAP_T, osg::Texture::CLAMP_TO_EDGE); } } //typedef std::list SourceListTmp;