From 9ce095dad349de6552e78bd05b19c5381bda6a7d Mon Sep 17 00:00:00 2001 From: Vlad Zahorodnii Date: Thu, 4 Jul 2024 14:14:58 +0300 Subject: [PATCH] opengl: Add OpenGlContext::glGetnTexImage() Add glGetnTexImage() to be consistent with other robustness stuff. --- src/opengl/openglcontext.cpp | 10 ++++++++++ src/opengl/openglcontext.h | 4 ++++ src/plugins/screencast/screencastutils.h | 6 +----- 3 files changed, 15 insertions(+), 5 deletions(-) diff --git a/src/opengl/openglcontext.cpp b/src/opengl/openglcontext.cpp index 12b8ce65bc..4aa1f3b81e 100644 --- a/src/opengl/openglcontext.cpp +++ b/src/opengl/openglcontext.cpp @@ -334,6 +334,7 @@ void OpenGlContext::glResolveFunctions(const std::function m_glPlatform; glGetGraphicsResetStatus_func m_glGetGraphicsResetStatus = nullptr; glReadnPixels_func m_glReadnPixels = nullptr; + glGetnTexImage_func m_glGetnTexImage = nullptr; glGetnUniformfv_func m_glGetnUniformfv = nullptr; ShaderManager *m_shaderManager = nullptr; GLVertexBuffer *m_streamingBuffer = nullptr; diff --git a/src/plugins/screencast/screencastutils.h b/src/plugins/screencast/screencastutils.h index 70387dfca0..4e03f760a4 100644 --- a/src/plugins/screencast/screencastutils.h +++ b/src/plugins/screencast/screencastutils.h @@ -60,11 +60,7 @@ static void doGrabTexture(GLTexture *texture, QImage *target) context->glReadnPixels(0, 0, size.width(), size.height(), closestGLType(target->format()), GL_UNSIGNED_BYTE, target->sizeInBytes(), target->bits()); GLFramebuffer::popFramebuffer(); } else { - if (context->openglVersion() >= Version(4, 5)) { - glGetnTexImage(texture->target(), 0, closestGLType(target->format()), GL_UNSIGNED_BYTE, target->sizeInBytes(), target->bits()); - } else { - glGetTexImage(texture->target(), 0, closestGLType(target->format()), GL_UNSIGNED_BYTE, target->bits()); - } + context->glGetnTexImage(texture->target(), 0, closestGLType(target->format()), GL_UNSIGNED_BYTE, target->sizeInBytes(), target->bits()); } if (invertNeededAndSupported) {