diff --git a/apps/openmw/mwgui/loadingscreen.cpp b/apps/openmw/mwgui/loadingscreen.cpp index e52b1b24ba..9787f847a9 100644 --- a/apps/openmw/mwgui/loadingscreen.cpp +++ b/apps/openmw/mwgui/loadingscreen.cpp @@ -289,6 +289,8 @@ namespace MWGui if (!mTexture) { mTexture = new osg::Texture2D; + mTexture->setWrap(osg::Texture::WRAP_S, osg::Texture::CLAMP_TO_EDGE); + mTexture->setWrap(osg::Texture::WRAP_T, osg::Texture::CLAMP_TO_EDGE); mTexture->setInternalFormat(GL_RGB); mTexture->setResizeNonPowerOfTwoHint(false); } diff --git a/apps/openmw/mwrender/characterpreview.cpp b/apps/openmw/mwrender/characterpreview.cpp index 73bd9db484..e143f077a4 100644 --- a/apps/openmw/mwrender/characterpreview.cpp +++ b/apps/openmw/mwrender/characterpreview.cpp @@ -275,6 +275,8 @@ namespace MWRender noBlendAlphaEnv->setCombine_RGB(osg::TexEnvCombine::REPLACE); noBlendAlphaEnv->setSource0_RGB(osg::TexEnvCombine::PREVIOUS); osg::ref_ptr dummyTexture = new osg::Texture2D(); + dummyTexture->setWrap(osg::Texture::WRAP_S, osg::Texture::CLAMP_TO_EDGE); + dummyTexture->setWrap(osg::Texture::WRAP_T, osg::Texture::CLAMP_TO_EDGE); dummyTexture->setInternalFormat(GL_DEPTH_COMPONENT); dummyTexture->setTextureSize(1, 1); // This might clash with a shadow map, so make sure it doesn't cast shadows diff --git a/apps/openmw/mwrender/luminancecalculator.cpp b/apps/openmw/mwrender/luminancecalculator.cpp index 06a0441d0d..a102fd6877 100644 --- a/apps/openmw/mwrender/luminancecalculator.cpp +++ b/apps/openmw/mwrender/luminancecalculator.cpp @@ -44,6 +44,8 @@ namespace MWRender buffer.mipmappedSceneLuminanceTex->setInternalFormat(GL_R16F); buffer.mipmappedSceneLuminanceTex->setSourceFormat(GL_RED); buffer.mipmappedSceneLuminanceTex->setSourceType(GL_FLOAT); + buffer.mipmappedSceneLuminanceTex->setWrap(osg::Texture::WRAP_S, osg::Texture::CLAMP_TO_EDGE); + buffer.mipmappedSceneLuminanceTex->setWrap(osg::Texture::WRAP_T, osg::Texture::CLAMP_TO_EDGE); buffer.mipmappedSceneLuminanceTex->setFilter(osg::Texture2D::MIN_FILTER, osg::Texture2D::LINEAR_MIPMAP_NEAREST); buffer.mipmappedSceneLuminanceTex->setFilter(osg::Texture2D::MAG_FILTER, osg::Texture2D::LINEAR); buffer.mipmappedSceneLuminanceTex->setTextureSize(mWidth, mHeight); @@ -53,11 +55,15 @@ namespace MWRender buffer.luminanceTex->setInternalFormat(GL_R16F); buffer.luminanceTex->setSourceFormat(GL_RED); buffer.luminanceTex->setSourceType(GL_FLOAT); + buffer.luminanceTex->setWrap(osg::Texture::WRAP_S, osg::Texture::CLAMP_TO_EDGE); + buffer.luminanceTex->setWrap(osg::Texture::WRAP_T, osg::Texture::CLAMP_TO_EDGE); buffer.luminanceTex->setFilter(osg::Texture2D::MIN_FILTER, osg::Texture2D::NEAREST); buffer.luminanceTex->setFilter(osg::Texture2D::MAG_FILTER, osg::Texture2D::NEAREST); buffer.luminanceTex->setTextureSize(1, 1); buffer.luminanceProxyTex = new osg::Texture2D(*buffer.luminanceTex); + buffer.luminanceProxyTex->setWrap(osg::Texture::WRAP_S, osg::Texture::CLAMP_TO_EDGE); + buffer.luminanceProxyTex->setWrap(osg::Texture::WRAP_T, osg::Texture::CLAMP_TO_EDGE); buffer.resolveFbo = new osg::FrameBufferObject; buffer.resolveFbo->setAttachment(osg::FrameBufferObject::BufferComponent::COLOR_BUFFER0, osg::FrameBufferAttachment(buffer.luminanceTex)); diff --git a/apps/openmw/mwrender/postprocessor.cpp b/apps/openmw/mwrender/postprocessor.cpp index 6e7af2c305..764db84ae4 100644 --- a/apps/openmw/mwrender/postprocessor.cpp +++ b/apps/openmw/mwrender/postprocessor.cpp @@ -160,6 +160,8 @@ namespace MWRender mTextures[i][Tex_OpaqueDepth] = new osg::Texture2DArray; else mTextures[i][Tex_OpaqueDepth] = new osg::Texture2D; + mTextures[i][Tex_OpaqueDepth]->setWrap(osg::Texture::WRAP_S, osg::Texture::CLAMP_TO_EDGE); + mTextures[i][Tex_OpaqueDepth]->setWrap(osg::Texture::WRAP_T, osg::Texture::CLAMP_TO_EDGE); } } diff --git a/apps/openmw/mwrender/screenshotmanager.cpp b/apps/openmw/mwrender/screenshotmanager.cpp index 40665cc250..e853f5ebf5 100644 --- a/apps/openmw/mwrender/screenshotmanager.cpp +++ b/apps/openmw/mwrender/screenshotmanager.cpp @@ -318,6 +318,8 @@ namespace MWRender texture->setResizeNonPowerOfTwoHint(false); texture->setFilter(osg::Texture::MIN_FILTER, osg::Texture::LINEAR); texture->setFilter(osg::Texture::MAG_FILTER, osg::Texture::LINEAR); + texture->setWrap(osg::Texture::WRAP_S, osg::Texture::CLAMP_TO_EDGE); + texture->setWrap(osg::Texture::WRAP_T, osg::Texture::CLAMP_TO_EDGE); camera->attach(osg::Camera::COLOR_BUFFER,texture); image->setDataType(GL_UNSIGNED_BYTE); diff --git a/apps/openmw/mwrender/skyutil.cpp b/apps/openmw/mwrender/skyutil.cpp index 1a3af5d3fe..71ad13acbd 100644 --- a/apps/openmw/mwrender/skyutil.cpp +++ b/apps/openmw/mwrender/skyutil.cpp @@ -482,7 +482,10 @@ namespace MWRender : mColor(osg::Vec4f(0,0,0,0)) , mTexture(new osg::Texture2D(imageManager->getWarningImage())) , mForceShaders(forceShaders) - { } + { + mTexture->setWrap(osg::Texture::WRAP_S, osg::Texture::CLAMP_TO_EDGE); + mTexture->setWrap(osg::Texture::WRAP_T, osg::Texture::CLAMP_TO_EDGE); + } void AtmosphereNightUpdater::setFade(float fade) { diff --git a/apps/openmw/mwrender/transparentpass.cpp b/apps/openmw/mwrender/transparentpass.cpp index eee7d72ecd..45f455d734 100644 --- a/apps/openmw/mwrender/transparentpass.cpp +++ b/apps/openmw/mwrender/transparentpass.cpp @@ -25,6 +25,8 @@ namespace MWRender image->setColor(osg::Vec4(1,1,1,1), 0, 0); osg::ref_ptr dummyTexture = new osg::Texture2D(image); + dummyTexture->setWrap(osg::Texture::WRAP_S, osg::Texture::CLAMP_TO_EDGE); + dummyTexture->setWrap(osg::Texture::WRAP_T, osg::Texture::CLAMP_TO_EDGE); constexpr osg::StateAttribute::OverrideValue modeOff = osg::StateAttribute::OFF | osg::StateAttribute::OVERRIDE; constexpr osg::StateAttribute::OverrideValue modeOn = osg::StateAttribute::ON | osg::StateAttribute::OVERRIDE; diff --git a/components/fx/parse_constants.hpp b/components/fx/parse_constants.hpp index 18d32ee53a..6220a08624 100644 --- a/components/fx/parse_constants.hpp +++ b/components/fx/parse_constants.hpp @@ -82,8 +82,7 @@ namespace fx {"s3tc_dxt1a" , osg::Texture::USE_S3TC_DXT1a_COMPRESSION} }}; - constexpr std::array, 6> WrapMode = {{ - {"clamp" , osg::Texture::CLAMP}, + constexpr std::array, 4> WrapMode = {{ {"clamp_to_edge" , osg::Texture::CLAMP_TO_EDGE}, {"clamp_to_border", osg::Texture::CLAMP_TO_BORDER}, {"repeat" , osg::Texture::REPEAT}, diff --git a/components/fx/technique.cpp b/components/fx/technique.cpp index 69ffd296ae..9da282cfe3 100644 --- a/components/fx/technique.cpp +++ b/components/fx/technique.cpp @@ -273,6 +273,8 @@ namespace fx rt.mTarget->setSourceFormat(GL_RGB); rt.mTarget->setInternalFormat(GL_RGB); rt.mTarget->setSourceType(GL_UNSIGNED_BYTE); + rt.mTarget->setWrap(osg::Texture::WRAP_S, osg::Texture::CLAMP_TO_EDGE); + rt.mTarget->setWrap(osg::Texture::WRAP_T, osg::Texture::CLAMP_TO_EDGE); while (!isNext() && !isNext()) { diff --git a/components/myguiplatform/myguirendermanager.cpp b/components/myguiplatform/myguirendermanager.cpp index 2ac65c559d..bdb4cd5a1b 100644 --- a/components/myguiplatform/myguirendermanager.cpp +++ b/components/myguiplatform/myguirendermanager.cpp @@ -187,6 +187,8 @@ public: mDummyTexture = new osg::Texture2D; mDummyTexture->setInternalFormat(GL_RGB); mDummyTexture->setTextureSize(1,1); + mDummyTexture->setWrap(osg::Texture::WRAP_S, osg::Texture::CLAMP_TO_EDGE); + mDummyTexture->setWrap(osg::Texture::WRAP_T, osg::Texture::CLAMP_TO_EDGE); // need to flip tex coords since MyGUI uses DirectX convention of top left image origin osg::Matrix flipMat; diff --git a/components/sceneutil/shadow.cpp b/components/sceneutil/shadow.cpp index 5220fce78a..a8018cec7e 100644 --- a/components/sceneutil/shadow.cpp +++ b/components/sceneutil/shadow.cpp @@ -86,6 +86,8 @@ namespace SceneUtil fakeShadowMapImage->allocateImage(1, 1, 1, GL_DEPTH_COMPONENT, GL_FLOAT); *(float*)fakeShadowMapImage->data() = std::numeric_limits::infinity(); osg::ref_ptr fakeShadowMapTexture = new osg::Texture2D(fakeShadowMapImage); + fakeShadowMapTexture->setWrap(osg::Texture::WRAP_S, osg::Texture::CLAMP_TO_EDGE); + fakeShadowMapTexture->setWrap(osg::Texture::WRAP_T, osg::Texture::CLAMP_TO_EDGE); fakeShadowMapTexture->setShadowComparison(true); fakeShadowMapTexture->setShadowCompareFunc(osg::Texture::ShadowCompareFunc::ALWAYS); for (int i = baseShadowTextureUnit; i < baseShadowTextureUnit + numberOfShadowMapsPerLight; ++i) diff --git a/components/stereo/multiview.cpp b/components/stereo/multiview.cpp index e0cac44714..9205d1f2e2 100644 --- a/components/stereo/multiview.cpp +++ b/components/stereo/multiview.cpp @@ -235,6 +235,8 @@ namespace Stereo } osg::ref_ptr texture2d = new osg::Texture2D; + texture2d->setWrap(osg::Texture::WRAP_S, osg::Texture::CLAMP_TO_EDGE); + texture2d->setWrap(osg::Texture::WRAP_T, osg::Texture::CLAMP_TO_EDGE); texture2d->setSubloadCallback(new Texture2DViewSubloadCallback(textureArray, layer)); texture2d->setTextureSize(textureArray->getTextureWidth(), textureArray->getTextureHeight()); texture2d->setBorderColor(textureArray->getBorderColor()); @@ -414,12 +416,16 @@ namespace Stereo auto tex = new osg::Texture2DMultisample(); tex->setTextureSize(width, height); tex->setNumSamples(samples); + tex->setWrap(osg::Texture::WRAP_S, osg::Texture::CLAMP_TO_EDGE); + tex->setWrap(osg::Texture::WRAP_T, osg::Texture::CLAMP_TO_EDGE); return tex; } else { auto tex = new osg::Texture2D(); tex->setTextureSize(width, height); + tex->setWrap(osg::Texture::WRAP_S, osg::Texture::CLAMP_TO_EDGE); + tex->setWrap(osg::Texture::WRAP_T, osg::Texture::CLAMP_TO_EDGE); return tex; } } diff --git a/docs/source/reference/postprocessing/omwfx.rst b/docs/source/reference/postprocessing/omwfx.rst index 7316c794c3..d310b21569 100644 --- a/docs/source/reference/postprocessing/omwfx.rst +++ b/docs/source/reference/postprocessing/omwfx.rst @@ -853,8 +853,6 @@ Types +------------------+---------------------+ | .omwfx | OpenGL | +==================+=====================+ -| clamp | GL_CLAMP | -+------------------+---------------------+ | clamp_to_edge | GL_CLAMP_TO_EDGE | +------------------+---------------------+ | clamp_to_border | GL_CLAMP_TO_BORDER |