Merge branch 'GLCLAMP_GOT_CLAMPED' into 'master'

Be more explicit about use of CLAMP_TO_EDGE instead of defaulting to GL CLAMP

See merge request OpenMW/openmw!3140
revert-6246b479
psi29a 2 years ago
commit e5ddd4036d

@ -295,6 +295,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);
}

@ -268,6 +268,8 @@ namespace MWRender
noBlendAlphaEnv->setCombine_RGB(osg::TexEnvCombine::REPLACE);
noBlendAlphaEnv->setSource0_RGB(osg::TexEnvCombine::PREVIOUS);
osg::ref_ptr<osg::Texture2D> 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

@ -35,6 +35,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);
@ -45,11 +47,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,

@ -164,6 +164,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);
}
}

@ -48,6 +48,8 @@ namespace
: mDummyTexture(new osg::Texture2D)
{
mDummyTexture->setInternalFormat(GL_RGB);
mDummyTexture->setWrap(osg::Texture::WRAP_S, osg::Texture::CLAMP_TO_EDGE);
mDummyTexture->setWrap(osg::Texture::WRAP_T, osg::Texture::CLAMP_TO_EDGE);
mDummyTexture->setTextureSize(1, 1);
Shader::ShaderManager& shaderMgr

@ -315,6 +315,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);

@ -482,6 +482,8 @@ namespace MWRender
, 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)

@ -26,6 +26,8 @@ namespace MWRender
image->setColor(osg::Vec4(1, 1, 1, 1), 0, 0);
osg::ref_ptr<osg::Texture2D> 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;

@ -82,8 +82,7 @@ namespace fx
{ "s3tc_dxt1a", osg::Texture::USE_S3TC_DXT1a_COMPRESSION },
} };
constexpr std::array<std::pair<std::string_view, osg::Texture::WrapMode>, 6> WrapMode = { {
{ "clamp", osg::Texture::CLAMP },
constexpr std::array<std::pair<std::string_view, osg::Texture::WrapMode>, 4> WrapMode = { {
{ "clamp_to_edge", osg::Texture::CLAMP_TO_EDGE },
{ "clamp_to_border", osg::Texture::CLAMP_TO_BORDER },
{ "repeat", osg::Texture::REPEAT },

@ -277,6 +277,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<Lexer::Close_bracket>() && !isNext<Lexer::Eof>())
{

@ -184,6 +184,8 @@ namespace osgMyGUI
mStateSet->setMode(GL_BLEND, osg::StateAttribute::ON);
mDummyTexture = new osg::Texture2D;
mDummyTexture->setWrap(osg::Texture::WRAP_S, osg::Texture::CLAMP_TO_EDGE);
mDummyTexture->setWrap(osg::Texture::WRAP_T, osg::Texture::CLAMP_TO_EDGE);
mDummyTexture->setInternalFormat(GL_RGB);
mDummyTexture->setTextureSize(1, 1);

@ -93,6 +93,8 @@ namespace SceneUtil
fakeShadowMapImage->allocateImage(1, 1, 1, GL_DEPTH_COMPONENT, GL_FLOAT);
*(float*)fakeShadowMapImage->data() = std::numeric_limits<float>::infinity();
osg::ref_ptr<osg::Texture> 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)

@ -243,6 +243,8 @@ namespace Stereo
}
osg::ref_ptr<osg::Texture2D> 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());
@ -429,12 +431,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;
}
}

@ -857,8 +857,6 @@ Types
+------------------+---------------------+
| .omwfx | OpenGL |
+==================+=====================+
| clamp | GL_CLAMP |
+------------------+---------------------+
| clamp_to_edge | GL_CLAMP_TO_EDGE |
+------------------+---------------------+
| clamp_to_border | GL_CLAMP_TO_BORDER |

Loading…
Cancel
Save