Don't generate mipmaps in GLTexture::bind()
This code is broken in a number of different ways; firstly by assuming that the mipmaps need to be regenerated when the texture filter has changed. Secondly by preventing mipmaps from being specified by other means. This commit removes the code from bind() and adds a generateMipmaps() method instead.
This commit is contained in:
parent
5ac159d47e
commit
aefadfaa6a
4 changed files with 13 additions and 5 deletions
|
@ -357,6 +357,7 @@ void LogoutEffect::renderBlurTexture()
|
|||
glEnable(GL_BLEND);
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
blurTexture->bind();
|
||||
blurTexture->generateMipmaps();
|
||||
blurTexture->render(infiniteRegion(), effects->virtualScreenGeometry());
|
||||
blurTexture->unbind();
|
||||
glDisable(GL_BLEND);
|
||||
|
|
|
@ -239,6 +239,7 @@ void LookingGlassEffect::postPaintScreen()
|
|||
assert(target == m_fbo);
|
||||
Q_UNUSED(target);
|
||||
m_texture->bind();
|
||||
m_texture->generateMipmaps();
|
||||
|
||||
// Use the shader
|
||||
ShaderBinder binder(m_shader);
|
||||
|
|
|
@ -283,7 +283,6 @@ void GLTexture::update(const QImage &image, const QPoint &offset, const QRect &s
|
|||
}
|
||||
|
||||
unbind();
|
||||
setDirty();
|
||||
|
||||
if (useUnpack) {
|
||||
glPixelStorei(GL_UNPACK_ROW_LENGTH, 0);
|
||||
|
@ -312,7 +311,6 @@ void GLTexture::bind()
|
|||
if (d->s_supportsFramebufferObjects && d->m_canUseMipmaps) {
|
||||
glTexParameteri(d->m_target, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);
|
||||
glTexParameteri(d->m_target, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
||||
glGenerateMipmap(d->m_target);
|
||||
} else {
|
||||
// can't use trilinear, so use bilinear
|
||||
d->m_filter = GL_LINEAR;
|
||||
|
@ -337,6 +335,14 @@ void GLTexture::bind()
|
|||
}
|
||||
}
|
||||
|
||||
void GLTexture::generateMipmaps()
|
||||
{
|
||||
Q_D(GLTexture);
|
||||
|
||||
if (d->m_canUseMipmaps && d->s_supportsFramebufferObjects)
|
||||
glGenerateMipmap(d->m_target);
|
||||
}
|
||||
|
||||
void GLTexture::unbind()
|
||||
{
|
||||
Q_D(GLTexture);
|
||||
|
@ -460,9 +466,7 @@ void GLTexture::setWrapMode(GLenum mode)
|
|||
|
||||
void GLTexturePrivate::onDamage()
|
||||
{
|
||||
if (m_filter == GL_LINEAR_MIPMAP_LINEAR && !m_filterChanged) {
|
||||
glGenerateMipmap(m_target);
|
||||
}
|
||||
// No-op
|
||||
}
|
||||
|
||||
void GLTexture::setDirty()
|
||||
|
|
|
@ -101,6 +101,8 @@ public:
|
|||
void setWrapMode(GLenum mode);
|
||||
void setDirty();
|
||||
|
||||
void generateMipmaps();
|
||||
|
||||
static bool framebufferObjectSupported();
|
||||
|
||||
protected:
|
||||
|
|
Loading…
Reference in a new issue