summaryrefslogtreecommitdiffstats
path: root/src/scenegraph/convenience/texturematerial.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/scenegraph/convenience/texturematerial.cpp')
-rw-r--r--src/scenegraph/convenience/texturematerial.cpp18
1 files changed, 8 insertions, 10 deletions
diff --git a/src/scenegraph/convenience/texturematerial.cpp b/src/scenegraph/convenience/texturematerial.cpp
index 8e03884..2c431e7 100644
--- a/src/scenegraph/convenience/texturematerial.cpp
+++ b/src/scenegraph/convenience/texturematerial.cpp
@@ -128,6 +128,12 @@ void TextureMaterialData::updateEffectState(Renderer *renderer, AbstractEffect *
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, filtering);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, filtering);
}
+
+ if (oldEffect == 0 || tx->clampToEdge() != oldTx->clampToEdge()) {
+ int wrapMode = tx->clampToEdge() ? GL_CLAMP_TO_EDGE : GL_REPEAT;
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, wrapMode);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, wrapMode);
+ }
}
@@ -226,20 +232,12 @@ AbstractEffectProgram *TextureMaterialWithOpacity::createProgram() const
void TextureMaterialWithOpacityData::updateEffectState(Renderer *renderer, AbstractEffect *newEffect, AbstractEffect *oldEffect)
{
+ TextureMaterialData::updateEffectState(renderer, newEffect, oldEffect);
+
Q_ASSERT(oldEffect == 0 || newEffect->type() == oldEffect->type());
TextureMaterialWithOpacity *tx = static_cast<TextureMaterialWithOpacity *>(newEffect);
TextureMaterialWithOpacity *oldTx = static_cast<TextureMaterialWithOpacity *>(oldEffect);
- if (oldEffect == 0 || tx->texture().texture() != oldTx->texture().texture()) {
- renderer->setTexture(0, tx->texture());
- oldEffect = 0; // Force filtering update.
- }
- if (oldEffect == 0 || tx->linearFiltering() != oldTx->linearFiltering()) {
- int filtering = tx->linearFiltering() ? GL_LINEAR : GL_NEAREST;
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, filtering);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, filtering);
- }
-
if (oldTx == 0 || tx->opacity() != oldTx->opacity())
m_program.setUniformValue(m_opacity_id, (GLfloat) tx->opacity());
}