Skip to content

Commit

Permalink
fix: InWindowBlur reports error in gles2
Browse files Browse the repository at this point in the history
  replacing glenable with glActiveTexture.
  using opengl's function to get sufface with.
  • Loading branch information
18202781743 committed Dec 11, 2023
1 parent ca277ef commit b32e676
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
18 changes: 17 additions & 1 deletion src/private/dblitframebuffernode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ class Q_DECL_HIDDEN GLRenderNode : public DBlitFramebufferNode {
m_texture->subRect.setSize(QSizeF(sourceRect.width() / fbo->width(),
sourceRect.height() / fbo->height()));
}
const QSizeF ss = QOpenGLContext::currentContext()->surface()->size() * scale;
const QSizeF ss = surfaceSize() * scale;
const QRectF transfromSR(sourceRect.x(), ss.height() - sourceRect.y(),
sourceRect.width(), -sourceRect.height());
QOpenGLFramebufferObject::blitFramebuffer(fbo.data(), QRect(QPoint(0, 0), textureSize),
Expand All @@ -142,6 +142,22 @@ class Q_DECL_HIDDEN GLRenderNode : public DBlitFramebufferNode {
doRenderCallback();
}

QSizeF surfaceSize() const
{
QOpenGLFunctions *f = QOpenGLContext::currentContext()->functions();
const GLuint InvalidFBOId = 0;
GLuint currentFBO = InvalidFBOId;
f->glGetIntegerv(GL_FRAMEBUFFER_BINDING, (GLint*)&currentFBO);
if (currentFBO != InvalidFBOId) {
int width, height;
f->glBindRenderbuffer(GL_RENDERBUFFER, currentFBO);
f->glGetRenderbufferParameteriv(GL_RENDERBUFFER, GL_RENDERBUFFER_WIDTH, (GLint*)&width);
f->glGetRenderbufferParameteriv(GL_RENDERBUFFER, GL_RENDERBUFFER_HEIGHT, (GLint*)&height);
return QSizeF(width, height);
}
return QOpenGLContext::currentContext()->surface()->size();
}

private:
SharedCachedFBO fbo;
};
Expand Down
3 changes: 1 addition & 2 deletions src/private/dblurimagenode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -633,12 +633,11 @@ void DOpenGLBlurEffectNode::applyDaulBlur(QOpenGLFramebufferObject *targetFBO, G
shader->enableAttributeArray(1);
m_sampleVbo->release();

glEnable(GL_TEXTURE_2D);
f->glActiveTexture(GL_TEXTURE0);
f->glBindTexture(GL_TEXTURE_2D, sourceTexture);
f->glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
f->glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
f->glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
glDisable(GL_TEXTURE_2D);
shader->release();
targetFBO->release();

Expand Down

0 comments on commit b32e676

Please sign in to comment.